Skip to content

Instantly share code, notes, and snippets.

@bradleysa
Created April 22, 2022 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradleysa/a5d46d7b011e39389f70c93eb11e9335 to your computer and use it in GitHub Desktop.
Save bradleysa/a5d46d7b011e39389f70c93eb11e9335 to your computer and use it in GitHub Desktop.
Redirect Author Archive
add_action('template_redirect', 'my_custom_disable_author_page');
function my_custom_disable_author_page() {
global $wp_query;
if ( is_author() ) {
// Redirect to homepage, set status to 301 permenant redirect.
// Function defaults to 302 temporary redirect.
wp_redirect(get_option('home'), 301);
exit;
}
}
/** https://wordpress.stackexchange.com/questions/277649/how-to-remove-the-author-pages **/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment