reorder plugin menu position

Looking for a function that I can use to reorder the admin position of a 3rd party plugin, and that will still work once said plugin gets updated.

  • Backstory
    AIO webmaster and All In One Events plugins are both forcing a menu position of 6. So if you load both plugins, the Events plugin “loses” and disappears.

I’d like a function to simply move AIO webmaster from say position 6 to somewhere else — best would be to remove the position all together, and have it fall into default menu order!

In the meantime, I’m hacking the AIO webmaster code from:

public function aiow_premium_menupage() {
    add_menu_page ( 'All in One Webmaster', 'AIO Webmaster', 'manage_options', 'aiow-premium', 'all_in_one_premium_webmaster_webmaster_page', plugins_url ( 'all-in-one-webmaster/images/favicon.ico' ), 6);

and removing the 6 position

public function aiow_premium_menupage() {
    add_menu_page ( 'All in One Webmaster', 'AIO Webmaster', 'manage_options', 'aiow-premium', 'all_in_one_premium_webmaster_webmaster_page', plugins_url ( 'all-in-one-webmaster/images/favicon.ico' ), 6);

..obviously, this only lasts until the plugin gets updated.

Any overriding function ideas to make that change stick?

1 Answer
1

Check if this solution (provided by @Syrehn) works: Reorder plugin items in the admin menu

Try taking just the name from the page admin link and see if it works. Something like this:

function custom_menu_order($menu_ord) {
if (!$menu_ord) return true;

return array(
    'index.php', // Dashboard
    'separator1', // First separator
    'edit.php', // Posts

    'pluginname2', // Take the name from the page menu admin.php?page=pluginname2

    'upload.php', // Media
    'edit.php?post_type=page', // Pages
    'edit-comments.php', // Comments

    'pluginname', // Take the name from the page menu admin.php?page=pluginname

);
}
add_filter('custom_menu_order', 'custom_menu_order'); // Activate custom_menu_order
add_filter('menu_order', 'custom_menu_order');

I would have made this a comment, but I can’t do that yet.

Leave a Comment