X

Create custom admin panel with add_menu_page

Adding a top level admin menu to your wordpress admin is simple just add this snippet to the functions.php of your wordpress theme. The new menu item will appear within the admin menu linking to the custom admin panel you define.


Code Snippet:


add_action('admin_menu', 'create_custom_panel');
function create_custom_panel() {
add_menu_page('Custom panel', 'Custom panel', 'manage_options', 'custom-panel', 'custom_panel');
}

function custom_panel(){
echo '<div class="wrap"><div id="icon-options-general" class="icon32">
<br>
</div>
<h2>Custom panel</h2></div>';
}

Comments  Leave a Reply

  1. how could you add a few custom posts into this menu?

  2. For example Can I include post.php on this page? How is that done?

    1. Can you elaborate ?

      1. Hello
        I don’t understand what you say !!!For example, how can I execute commands post.php on this page?

        1. Hi N3sted I need more detail before I can help, commands post.php i’m not sure what you mean.

        2. thanks for the follow-up response
          in this panel,how can I call the command post or other command ?

  3. Thank you I found the solution

  4. Thank you I found the solution

  5. How can I customize this page to edit  ” ?page=custom-panel ” ?

  6. How can I customize this page to edit  ” ?page=custom-panel ” ?

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!