Add an admin WordPress page not shown in the menu

This snippet shows you how to add custom admin pages to WordPress without adding them to the menu, this is useful for plugins that have sub-pages that aren't directly accessible (e.g. an editing page). 

Adding pages to the menu or sub menus in WordPress (add_menu_page, add_submenu_page), will append the page to the list of accessible sections in the admin area. Without this you'll likely see the following error:

"You do not have sufficient permissions to access this page."

Overcoming this is a little backward, but the easiest solution is to add to a sub menu but set the parent as null (thus it doesn't attach itself to any part of the menu, but is added to the list of accessible pages). 

Here's an example:

    'Page Title',
    'page_callback_function' )

Sign Up
comments powered by Disqus

Popular Tags

Need a web developer?

If you'd like to work with code synthesis on your next project get in touch via the contact page.