Skip to content

Instantly share code, notes, and snippets.

@chrisdigital
Created April 21, 2013 04:05
Show Gist options
  • Save chrisdigital/5428443 to your computer and use it in GitHub Desktop.
Save chrisdigital/5428443 to your computer and use it in GitHub Desktop.
Disable author page in Wordpress redirect to hp
#
#http://wordpress.stackexchange.com/questions/74924/disable-author-pages-for-specific-users
#
function tst() {
global $wp_query;
if (is_author() && !empty($wp_query->query['author_name'])) {
$author = get_user_by('login',$wp_query->query['author_name']);
if ( 1 === $author->ID) {
wp_safe_redirect(get_bloginfo('url'),'301'); // or whatever you want
}
}
}
add_action('template_redirect','tst');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment