Change WordPress user roles and capabilities Forums How to or FAQ Disable Edit my profile from right top admin dropdown

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5465
    nordin
    Participant

    I have found the way to disable the access to a users own profile page by selecting admin menu button from the user role editor. This disabled access to a users own user profile editing page. It also deleted the profiles tab from the left menu, but it did not delete the edit my profile link from the admin right top dropdown menu…
    How do I delete this from the users admin environment? Because right now it has the link “edit my profile” on there, you can click it but it just goes to dashboard. I want it to be gone completely for the user.

    #5469
    Vladimir
    Keymaster

    URE does not hide this admin bar menu item by default.
    Add this code to your active theme functions.php file or setup it as a must-use plugin to change default behavior:

    
    add_filter('ure_do_not_remove_from_admin_bar', 'ure_do_not_remove_from_admin_bar', 10, 1);
    
    function ure_do_not_remove_from_admin_bar( $exclusions ) {
        
        foreach( $exclusions as $key=>$item ) {
        
            if ( $item==='edit-profile' ) {
                unset( $exclusions[$key] ) ;
                break;
            }
        }
    
        return $exclusions;
    }
    
    #5504
    nordin
    Participant

    Thank you.

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