• Resolved davemspan

    (@davemspan)


    Hello. I’d like to hide access to this plugin for any backend rol which is not the administrator.
    I could use something like below if i knew what the permission was. “trustindex-google-reviews” does not seem to work. Anyone got a solution for this?

    Thank-you

    function hide_trustindex_from_editors() {
        if (!current_user_can(‘administrator’)) {
            remove_menu_page(‘trustindex-google-reviews’); // You may need to update this slug
        }
    }
    add_action(‘admin_menu’, ‘hide_trustindex_from_editors’, 999);

Viewing 1 replies (of 1 total)
  • Plugin Support Laca

    (@lacadev)

    Hi @davemspan

    If you want to hide the plugin menu page from all non-admin users, you can modify your code like this:

    add_action('admin_menu', 'restrict_reviews_plugin_menu_access', 999);
    
    function restrict_reviews_plugin_menu_access() {
        if ( !current_user_can('administrator') ) {
            remove_menu_page('wp-reviews-plugin-for-google/settings.php');
        }
    }

    Let me know if you have any further questions!

    Best regards,
    Laca from Trustindex

Viewing 1 replies (of 1 total)

The topic ‘Hide access to non admin role’ is closed to new replies.