Redirect WordPress Author Pages to Home

01/30/2024
Back to Blogs
<?php
/**
 * Redirect Author Page to Home
 *
 * Gist Keywords: wordpress, author page, redirect
 * Author: Knol Aust
 * Version: 1.0.0
 *
 * This function redirects the Author Page to the home page with a 301 permanent redirect.
 */
function knolaust_redirect_author_page() {
  global $wp_query;

  if ( is_author() ) {
    // Redirect to home, set status to 301 permanent or 302 temporary 
    wp_redirect(get_option('home'), 301); 
    exit; 
  }
}
add_action('template_redirect', 'knolaust_redirect_author_page');