0

I'm using following code to change menu order of WordPress admin panel.

function reorder_admin_menu( $__return_true ) {
    return array(
         'index.php', // Dashboard
         'separator1', // --Space--
         'edit.php?post_type=page', // Pages
         'edit.php', // Posts
         'edit.php?post_type=portfolio', // Portfolio
         'admin.php?page=wpcf7', // Contact Form 7
         'upload.php', // Media
         'edit-comments.php', // Comments
   );
}
add_filter( 'custom_menu_order', 'reorder_admin_menu' );
add_filter( 'menu_order', 'reorder_admin_menu' );

Now, it is working fine for WordPress default menu items (e.g. posts, pages, media etc). But it seems to be ignoring menu items having a slug of admin.php?page=xxx.

For example, I'm using admin.php?page=wpcf7 for Contact Form 7 plugin menu to put it above Media menu link but it is still getting positioned below Media and Comments menu link.

How can I resolve this issue?

1

Instead of this:

return array(
     'index.php', // Dashboard
     'separator1', // --Space--
     'edit.php?post_type=page', // Pages
     'edit.php', // Posts
     'edit.php?post_type=portfolio', // Portfolio
     'admin.php?page=wpcf7', // Contact Form 7
     'upload.php', // Media
     'edit-comments.php', // Comments
   );

try this:

return array(
     'index.php', // Dashboard
     'separator1', // --Space--
     'edit.php?post_type=page', // Pages
     'edit.php', // Posts
     'portfolio', // Portfolio
     'wpcf7', // Contact Form 7
     'upload.php', // Media
     'edit-comments.php', // Comments
   );
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.