Rename menu items for All except super admin

/** * Changes Label of Admin Menu items * @global array $menu * @global array $submenu */ function change_post_menu_label() { global $menu; global $submenu; $menu[2][0] = ‘Home’; $menu[5][0] = ‘Articles’; $submenu[‘edit.php’][5][0] = “All Articles”; // var_dump($submenu); // var_dump($menu); echo ”; } if(!is_super_admin()){ add_action( ‘admin_menu’, ‘change_post_menu_label’ ); } You can print the array echo “<pre>”; print_r($menu); … Read more

Hide a menu on posts

if (is_single()) { // DONT SHOW MENUS } you may pass a post id for any specific post for eg – if (is_single(‘4’)) { // DONT SHOW MENUS } will execute on post with id = 4 . hope it helps

How to use wp_nav_menu with hashtag links?

You already hinted it yourself: When you look at wp_get_nav_menu_items() you’ll see that the resulting Array of items gets mapped over with wp_setup_nav_menu_item() – in other words, this function gets applied to each and every nav menu item. In there you can hook into the ‘wp_setup_nav_menu_item’-filter with its $menu_item argument, or use one of the … Read more

Custom Menu not functioning properly

By specifying a theme_location argument in my array, the issue was fixed: wp_nav_menu(array( ‘theme_location’ => ‘main_menu’ )); Edit For a distributed Theme, do not pass the ‘menu’ parameter to the wp_nav_menu() call. It will look for a specific slug of a user-created menu, and will override ‘theme_location’. Only ever pass ‘theme_location’.

Want to add different text after each menu item

You need a Custom Walker for this. In your Custom Walker you define the start of the element different, adding a span after the link: class Walker_With_Title_Menu extends Walker_Nav_Menu { function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $output .= sprintf( “\n<li><a href=”https://wordpress.stackexchange.com/questions/131521/%s”%s>%s</a><span class=”your-line”>%s</span></li>\n”, $item->url, ( $item->object_id === … Read more