• Resolved daparat

    (@daparat)


    Hi, Is there a way of only showing QM to one user, we have 5 administrators but only I need to see QM.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Yes you can do this by denying the view_query_monitor capability from users who you don’t wish to have it. Here’s some example code.

    add_filter( 'user_has_cap', function( $allcaps, $caps, $args, $user ) {
    if ( 'view_query_monitor' === $args[0] ) {
    // Put your logic here:
    if ( my_condition( $user ) ) {
    $allcaps['view_query_monitor'] = false;
    }
    }
    return $allcaps;
    }, 9, 4 );
    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Alternatively you can use any one of the user role management plugins available that allow you to specifically deny a capability from a user. That way you don’t need to write any code for it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.