Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WordPress Prevent Author Lookup
function redirect_to_home_if_author_parameter() {
$is_author_set = get_query_var( 'author', '' );
if ( $is_author_set != '' && !is_admin()) {
wp_redirect( home_url(), 301 );
add_action( 'template_redirect', 'redirect_to_home_if_author_parameter' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.