I’ll show you how to set custom admin sidebar menu positions for WordPress plugins and themes in this post. When you set up your administrator option page it may generally look like the below.
add_action( 'admin_menu', 'my_plugin_menu' );
function my_plugin_menu() {
add_options_page(
'My Options',
'My Plugin',
'manage_options',
'my-plugin.php',
'my_plugin_page'
);
}
Now we just want to set the priority of the admin_menu action, that will determine where your ‘My Options’ page will land in the sidebar.
Here are the default order with priorities for (add_options_page) admin menus:
Default: null - defaults to below Comments
5 - below Posts
10 - below Media
15 - below Links
20 - below Pages
25 - below comments
60 - below first separator
65 - below Plugins
70 - below Users
75 - below Tools
80 - below Settings
100 - below second separator
Placing our settings page below the Plugins menu will look something like this.
add_action( 'admin_menu', 'my_plugin_menu', 65 ); // Change the priority number.
function my_plugin_menu() {
add_options_page(
'My Options',
'My Plugin',
'manage_options',
'my-plugin.php',
'my_plugin_page'
);
}
That’s all! I hope that helps ?