Support » Developing with WordPress » Admin Menu keys

  • how do you find out what admin menu keys have been used?

    I want to rename an Admin menu label, I know posts use [5] and post submenu category uses [15] but how do find what others use so I can rename them using a functions global rename.

    <?php
    function wd_admin_menu_rename() {
         global $menu; // Global to get menu array
         global $submenu; // Global to get submenu array
         $menu[5][0] = 'Portfolio'; // Change name of posts to portfolio
         $submenu['edit.php'][5][0] = 'All Portfolio Items'; // Change name of all posts to all portfolio items
    }
    add_action( 'admin_menu', 'wd_admin_menu_rename' );
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Hook “admin_menu” action with a very large priority arg (3rd arg) to ensure your code runs after other elements have added their menu items. print_r() the global $menu and $submenu values. The arrays are organized by position keys.

    The output may not appear on admin screens, but if you view the page source HTML it ought be visible somewhere. If that fails, output the listing to a file or email it to yourself.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.