-
MelParker
Hi, I would like to know if I need to disable the Author archives page is it is not used (linked to) on my site.
How can I view or test this page?
I do have an “Author header” Element (Type: Block – Page Hero, Location: Author Archives) that is part of the MyPet template.
So should I disable author archives by redirect to the home page? Via SEO plugin or Code snippets plugin?
https://www.optimumcreative.com/disable-author-archive-author-page-or-author-url-in-wordpress/
Should I use this method via the Code Snippts Plugin:
2- The PHP/Wordpress way
You can do this by using template_redirect hook. See below code example.
function oc_author_page_redirect() {
if ( is_author() ) {
wp_redirect( home_url() );
}
}
add_action( ‘template_redirect’, ‘oc_author_page_redirect’ );You should add above code to functions.php file in active WordPress theme. This code will redirect all author pages to website homepage.
Or should I use my SEO Plugin (rankMath) with this setting:
Redirections
Redirect non-existent content easily with 301 and 302 status code. This can help improve your site ranking. Also supports many other response codes.Thanks
-
David
Hi there,
if you’re using RankMath then i would recommend you use its settings to “remove” the author archives.
-
MelParker
Thanks for the recommendation. I now set this via RankMath.
-
David
Glad to be of help!
- You must be logged in to reply to this topic.