Skip to content

Instantly share code, notes, and snippets.

@marcbacon
Created October 21, 2015 16:19
Show Gist options
  • Save marcbacon/126423e619fe6b90cec9 to your computer and use it in GitHub Desktop.
Save marcbacon/126423e619fe6b90cec9 to your computer and use it in GitHub Desktop.
Hide author pages. Redirect anyone trying to view author info by appending ?author=1 to url to the home page. This secures the site by hiding user id's from possible hackers.
/**
* Hide author pages. Redirect anyone trying to view author info
* by appending ?author=1 to url to the home page.
* This secures the site by hiding user id's from possible hackers.
*/
function author_redirect() {
if ( is_author() ) {
wp_redirect( home_url() ); exit;
}
} // author_redirect()
add_action('template_redirect', 'author_redirect');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment