There are a few reasons why you might want to redirect author pages on a website:
- If a website has multiple authors, each with their own author page, redirecting all of these pages to a single page can help consolidate the content and make it easier for users to find information about all of the authors in one place.
- Maintaining multiple author pages can be time-consuming, especially if the website has a large number of authors. Redirecting these pages can help reduce the amount of maintenance required.
Table of Contents
Code Snippets
This code defines a function called redirect_author_archive which redirects the user to the about page of the website if they are not an administrator.
function redirect_author_archive() {
if(!is_admin()) {
wp_redirect(home_url('about'));
exit();
}
}
add_action('template_redirect', 'redirect_author_archive');
This code defines a function called redirect_author_archive which redirects the user to the homepage of the website if they are not an administrator.
function redirect_author_archive() {
if(!is_admin()) {
wp_redirect(home_url('/'));
exit();
}
}
add_action('template_redirect', 'redirect_author_archive');
More Code Snippets
There are more code snippets where this came from.