Created
April 21, 2013 04:05
Disable author page in Wordpress redirect to hp
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
# | |
#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