I’m trying to make it so that I can go to the pages of only certain authors, and a redirect will work for the rest. I’m trying to do this through is_author, but it does not accept meta arguments, and does not understand != Perhaps someone knows how to solve this problem. Thank you!
i tried this in function.php :
function redirect_author_page() {
global $wp_query;
if (is_author($author != array('name1', 'name2'))) {
wp_safe_redirect(get_option('home'), 301);
exit;
}
}
add_action(‘template_redirect’, ‘redirect_author_page’);
2
Answers
According to an example in the docs of the function
is_author
!= means not equal, but doesn’t work in this instance. If you wanted to use it in the case of is_author() you’d add the ‘not’ at the beginning. You also need a comma separating the parameters.