I want to create some pages in admin dashboard which are also shown to subscribers. Normally subscriber can see dashboard page and profile only. I want to create a page called Orders and show to subscribers. But not other pages.

How can I do ?

Thanks in Advance.


1 Answer 1


First off, you can add a menu (or an admin) page using:

And there are also helper/wrapper functions you can use for adding a submenu page to the standard WordPress menu pages such as add_users_page() for the Users/Profile page. You can check the other available helper functions on the Related → Used By section on this page.

All those functions have a $capability parameter which is the minimum user/role capability required to view/access the menu page (and link). So you can use that parameter to restrict the menu page to certain users.

Here's an example for your case, where the role is subscriber which has the capability read:

function my_add_orders_menu_page() {
        'Orders',             // Page title.
        'Orders',             // Menu title.
        'read',               // Capability.
        'my-orders',          // Menu slug.
        'my_orders_menu_page' // The callback that renders the menu page.
add_action( 'admin_menu', 'my_add_orders_menu_page' );

function my_orders_menu_page() {
    echo 'Yay, it works!';

Note: You should read the note about option_page_capability_{$option_group} on this page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.