WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] add_menu_page for multiple users (2 posts)

  1. hawkyhawk14
    Member
    Posted 1 year ago #

    Due to the unique way in which WordPress works it appears to be impossible to use add_menu_page for multiple roles. By declaring the same add_menu_page for two roles means one over-rides the other, and it will show only for the last declared one.

    So, how can anyone use add_menu_page for two or more user role types. I want my plugin dashboard menu items to appear for both administrators and editors.

  2. hawkyhawk14
    Member
    Posted 1 year ago #

    I worked out a fix

    add_menu_page('Memberships', 'Memberships', 'administrator','CWF_Memberships*', 'myp_memberships');
        add_menu_page('Memberships', 'Memberships', 'editor','CWF_Memberships', 'myp_memberships');
        add_menu_page('Resources', 'Resources', 'editor' , 'CWF_Resources', 'myp_resources');

    And yes..... add a * to the slug is the fix.

    WordPress really is s***!

Topic Closed

This topic has been closed to new replies.

About this Topic