I wanted to know if there were any ways to easily hide a selected user's user page. I've yet to find any code that does so. I've only found code to remove all user pages.


3 Answers 3


I'm assuming you want to hide the author page on the site itself (and not in wp-admin).

To do that, just create a new template file called author-{$id}.php, where {$id} is replaced by the ID of the author you want to hide. So if the author ID is 6, the template file should be called author-6.php.

Inside the new file, put this in:

header( "HTTP/1.1 301 Moved Permanently" );
wp_redirect( get_home_url() );

Now when you try to load the author's page, it will just redirect to the site visitor to your home page.


  • PS: @Faysal Mahamud's answer is perfect if you wanted to hide the user in wp-admin.
    – ricotheque
    Commented Mar 9, 2017 at 5:50

If you want to hide the user in user list page. The following working for you.


Here is the code which hides specific user. It is tested and working fine.

Add this in functions.php in your theme.


//change user-14 to your user id.

  add_action('admin_head' , 'ft_hide_administrator_user');
    function ft_hide_administrator_user(){
      global $pagenow;
      if ( 'users.php' == $pagenow ){
        <script type='text/javascript' >
          //jQuery('#user-14').remove(); // to remove users.php list page html
          jQuery('#user-14').hide(); // to hide users.php list page html
            var total_count = jQuery(".users-php .subsubsub li.all .count").text();
            total_count = total_count.substring(1, total_count.length - 1) - 1;
            jQuery('.users-php .subsubsub li.all .count').text('('+total_count+')');

            var total_count = jQuery(".users-php .subsubsub li.administrator .count").text();
            total_count = total_count.substring(1, total_count.length - 1) - 1;
            jQuery('.users-php .subsubsub li.administrator .count').text('('+total_count+')');


I think we can use pre_user_query filter and modify or adjust the where query. Something like the following code:

add_action( 'pre_user_query', function( $uqi ) {
    global $wpdb;
    $uqi->query_where .=  ' AND id != 1';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.