Adding custom li after last element of WordPress navigation menu

When working with wordpress menu you may need to add a custom item in the last of wordpress menu.You can achieve this with wordpress menu walker class.But wordpress menu walker class is for heavy customizing the wordpress menu like building mega menu.

We can achieve this solution with a wordpress filter add_filter(‘wp_nav_menu_items’, ‘new_nav_menu_items’, 10, 2);

Copy and paste the following code in your function.php file and you will get your change.