Posted in WordPress

Add custom menu to WordPress admin menu

Add custom menu to WordPress admin menu Posted on November 28, 2015Leave a comment

When you develop a plugin in WordPress, maybe you have to create a setting page for your plugin or some pages for special reasons and after your page is done, you need to create a link on the menu to go into that page.

This is a common way to add a custom menu:

Step 1: Create your setting page

You can create a function or a php file that stores your html elements.

Step 2: Create a function and paste this code

Step 3: Hook to admin_menu action

Here is the example:

Notice: if the position parameter is omitted, your custom menu will appear at the bottom of the admin menu. Here is the list of default menus position:

And be careful if your custom menu uses the same position attribute with an existed menu, it will overwrite this one.

I hope this article helped you learn how to add custom menu on WordPress admin menu.



Leave a Reply

Your email address will not be published. Required fields are marked *