Home > other >  how to chance order of plugins wordpress
how to chance order of plugins wordpress

Time:06-18

I would like to have my custom plugin on top of the sidebar. Haven't found how the order is made. Now my custom plugin is at the bottom. I would like to move it near the top.

CodePudding user response:

You can choose the menu position with add_menu_page() like this:

add_menu_page( 
    __( 'Custom Menu Title', 'textdomain' ),
    'custom menu',
    'manage_options',
    'custompage',
    'my_custom_menu_page',
    plugins_url( 'myplugin/images/icon.png' ),
    6 //choose your Position!!!!
);

These are the default values for "position":

  • 2 – Dashboard
  • 4 – Separator
  • 5 – Posts
  • 10 – Media
  • 15 – Links
  • 20 – Pages
  • 25 – Comments
  • 59 – Separator
  • 60 – Appearance
  • 65 – Plugins
  • 70 – Users
  • 75 – Tools
  • 80 – Settings
  • 99 – Separator

In your case, if you type 0 or 1 in the position field your custom menu will be displayed at the top of the "Dashboard" menu.

  • Related