This code below will prevent WordPress from indexing the Author and Category.
Add this code to your functions.php file.
Check this by using screaming frog.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
add_action('template_redirect', 'mikes_remove_wp_archives'); /* Remove archives */ function mikes_remove_wp_archives(){ //If we are on category or tag or date or author archive if( is_category() || is_tag() || is_date() || is_author() ) { global $wp_query; wp_redirect( home_url( '/' ) ); // $wp_query->set_404(); //set to 404 not found page } } |
You can also do this from the .htaccess file
1 2 3 4 5 6 |
RewriteEngine On RewriteCond %{REQUEST_URI} !^/wp-admin [NC] RewriteCond %{QUERY_STRING} author=\d RewriteRule ^ /? [L,R=301] |
You can test this by visiting www.mywebsite.co.uk?author=1
After applying a script visit the url of your website and see if it still appears.