• Resolved David Gard

    (@duck_boy)


    Hey all,

    I’m manipulating the admin menu a little bit to get all my custom post types together and to also add a separator. I can add the separator fine, and also unset what I don’t want, but I’m having trouble moving the Media and Links menu

    add_action('admin_head', 'edit_admin_menu');
    function edit_admin_menu(){
    	global $menu;
    	unset($menu[5]); // Unset Posts
    	$menu[18] = $menu[10]; // Copy Media from position 10 to position 14
    	unset($menu[10]); // Unset Media (from original position)
    	$menu[19] = $menu[15]; // Copy Links from position 15 to position 19
    	unset($menu[15]); // Unset Links (from original position)
    	$menu[14] = Array('', 'read', 'separator-custom-post-types', '', 'wp-menu-separator');
    }

    Using echo '<pre>'; print_r($menu[18]); echo '</pre>'; or echo '<pre>'; print_r($menu[19]); echo '</pre>'; will display the correct values for the Media and Links menus, but when the menu is written, or if I use echo '<pre>'; print_r($menu); echo '</pre>'; they are both missing.

    Is there something I am doing wrong here?

    Any help would be appriciated.

    Thanks.

Viewing 1 replies (of 1 total)
  • Thread Starter David Gard

    (@duck_boy)

    Sorry, got it now – added ksort($menu); to the bottom of the function and they are now there and in the right order.

    Thanks.

Viewing 1 replies (of 1 total)
  • The topic ‘Moving admin menu items’ is closed to new replies.