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.
Thanks
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.
Thanks
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:
<?php
header( "HTTP/1.1 301 Moved Permanently" );
wp_redirect( get_home_url() );
exit;
?>
Now when you try to load the author’s page, it will just redirect to the site visitor to your home page.
(Source)