Created
April 22, 2022 08:26
-
-
Save bradleysa/a5d46d7b011e39389f70c93eb11e9335 to your computer and use it in GitHub Desktop.
Redirect Author Archive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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