Skip to content
Advertisement

How to give editor access to a custom made admin menu page?

I created an admin menu page in WordPress. But it is accessible only to admin. How to make it available to the editor also.

function essof_add_setup_page()
{
    add_menu_page(
        __('Essof Setup', 'textdomain'),
        __('Essof Setup', 'textdomain'),
        'manage_options',
        'setup',
        'essof_setup_page',
        'dashicons-admin-tools',
        4
    );
}


add_action('admin_menu', 'essof_add_setup_page');

Advertisement

Answer

You’ll need to change the capability to an editor’s capability, i.e., editor:

add_menu_page(
    'parent_slug',
    'page_title',
    'menu_title',
    'editor',
    'menu_slug',
    'callback function'
);

Check here for detailed description: https://developer.wordpress.org/reference/functions/add_menu_page/

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement