Last active
March 30, 2018 19:10
-
-
Save 1naveengiri/1e7fe2763ee40704b74500549038fbe3 to your computer and use it in GitHub Desktop.
How to add custom link as menu Item programmatically in WordPress Menu?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* To add a custom link as custom menu item in WordPress menu | |
*/ | |
$menu_id = 4; // WordPress menu ID. | |
wp_update_nav_menu_item($menu_id, 0, array( | |
'menu-item-title' => __('Home'), | |
'menu-item-classes' => 'home', | |
'menu-item-url' => 'http://buddydevelopers.com', | |
'menu-item-status' => 'publish' | |
'menu-item-type' => 'custom', | |
// 'menu-item-target' => '_blank', | |
// 'menu-item-xfn' => 'friend' | |
) | |
); | |
To read more please visit link below. | |
http://buddydevelopers.com/how-to-add-menu-item-programmatically-in-wordpress/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment