How to Change the Order of the Menu for WordPress Plugins
WordPress plugins -- add-ons you can install into WordPress -- sometimes come with options pages. These pages allow users to set up plugins with account information or to add style rules to make the plugins fit with their websites. You can edit the order that plugin option pages appear in the dashboard menu by giving the pages specific position values. When you add a number to the end of the "add_menu_page()" function, you can move the options page up or down in the menu.
Instructions
-
-
1
Log into the WordPress dashboard from your website's wp-admin directory. Navigate to "Plugins" and click the "Editor" link. Select the plugin you want to edit from the drop-down box.
-
2
Locate the "add_menu_page()" function in the code of the plugin. If you do not find this code in the file that automatically loaded when you selected the plugin in the editor, look for it in any other files the plugin uses. The files are listed to the right of the editor.
-
-
3
Add the position setting as the last parameter in the "add_menu_page()" function. This parameter takes integer numbers, such as "5" or "20." The lower the number, the higher the menu page for your plugin to appear in the dashboard menu. By default, plugin options pages go to the bottom of the menu. Here is an example of an "add_menu_page()" function with the position parameter added to the end of the parameter list:
add_menu_page( 'The Plugin Options', 'My Plugin', 'edit_plugins', 'my-plugin-options', 'mypluginfunction', 20 );
In this example, adding "20" to the end of the parameter list puts this plugin options page at the bottom of the menu.
-
4
Locate the "add_submenu_page()" functions in your plugin if any sub-menus exist. You cannot give each its own position setting, but the first sub-menu created will appear first in the list. Reorder the functions to reorder the sub-menu pages.
-
1
Tips & Warnings
Back up your files before editing them. If you make mistakes in your changes, resulting in errors, re-upload the original plugin files to their respective folders in /wp-content/plugins/plugin-name/.
References
- Photo Credit Polka Dot RF/Polka Dot/Getty Images