When your website means business.

Security, Users | Type: PHPHide Usernames from Hackers

When hackers discover your username, they have half the equation for logging in.

METHOD 1 - add to bottom of .htaccess, redirects www.domain.com/?author=1 queries back to homepage
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/wp-admin [NC]
RewriteCond %{QUERY_STRING} author=\d
RewriteRule ^ /? [L,R=301]
METHOD 2 - added to functions.php, does the same thing as above htaccess
function 
redirect_to_home_if_author_parameter() {
	$is_author_set = get_query_var( 'author', '' );
	if ( $is_author_set != '' && !is_admin()) {
		wp_redirect( home_url(), 301 );
		exit;
	}
}
add_action( 'template_redirect', 'redirect_to_home_if_author_parameter' );

Reference Links

We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept