Created
July 17, 2018 11:08
-
-
Save patrickposner/723d318c29f4fdb951a94bf5ae89b004 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /* "wp" is the earliest possible hook before rendering a page */ | |
| add_action( 'wp', 'disable_author_page' ); | |
| function disable_author_page() { | |
| /* get global $wp_query object */ | |
| global $wp_query; | |
| /* If an author page is requested, answer with 404 | |
| if ( $wp_query->is_author ) { | |
| $wp_query->set_404(); | |
| status_header( 404 ); | |
| get_template_part( 404 ); | |
| exit(); | |
| } | |
| */ | |
| /* If an author page is requested, redirect with 301 */ | |
| if ( $wp_query->is_author ) { | |
| wp_safe_redirect( get_bloginfo( 'url' ), 301 ); | |
| exit; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment