Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8043937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:04:16+00:00 2026-06-05T05:04:16+00:00

I’m looking to use add_menu_page to add a new section to the WordPress dashboard.

  • 0

I’m looking to use add_menu_page to add a new section to the WordPress dashboard. My only issue is where to put this code? I’ve looked around at several tutorials and frustratingly not one mentions where to add the code!

If someone could tell me:

  1. Where to put your add_menu_page code and
  2. Where to register the function passed as a parameter to the add_menu_page function

that would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:04:19+00:00Added an answer on June 5, 2026 at 5:04 am

    Normally I wouldn’t answer a question that doesn’t have any code that you’ve already tried in, but it seems like this is a more abstract question so I’ll give a more abstract answer.

    ‘Hacking’ into WordPress is achieved by using hooks that are triggered when certain actions are executed by WordPress. When a hook is reached the system checks to see if there are any functions registered that are to be called at that point in the execution. Your menu page can be registered in the functions.php file of your theme or in a plugin file – it doesn’t really matter as long as you register it with the appropriate action hook.

    Example

    First we need a page for the menu item to link to (create this page anywhere, but ideally in your theme directory if you’re doing a theme or plugin directory if you’re doing a plugin). I called mine settings_page.php and put it in my theme directory.

    Then we’ve got your function to register your menu page (in functions.php if you’re doing a theme or in your main plugin file if you’re doing a plugin):

    function create_menu() {
        $settings_page = add_menu_page( 
            __("My Settings", EMU2_I18N_DOMAIN),
            __("My Settings", EMU2_I18N_DOMAIN),
            0,
            THEME_DIRECTORY.'/settings_page.php' 
            // obviously replacing THEME_DIRECTORY with your actual directory
        );
    }
    

    Then we register your menu page with the WordPress hook – in this case the ‘admin_menu’ hook (in the same file as the one you registered your function above in):

    add_action( 'admin_menu', 'create_menu' );
    

    Now you’re done. I’ve listed a couple of extra resource below in case you want to delve into anything a bit deeper, but I hope that helped lay a bit more groundwork as to what’s going on under the surface.

    Extra Resources

    Function reference for create_menu in WordPress codex

    Function reference for create_sub_menu in WordPress codex

    List of WordPress Hooks

    WordPress tutorial for writing a plugin

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.