Disable Author Archives
Redirects author archive pages to the homepage. Good for single-author sites where the author archive duplicates the blog page.
Opens WPIDE on
Code
add_action( 'template_redirect', function () {
if ( is_author() ) {
wp_safe_redirect( home_url( '/' ), 301 );
exit;
}
} );
add_filter( 'author_link', function () {
return home_url( '/' );
} );
add_filter( 'wp_sitemaps_add_provider', function ( $provider, $name ) {
return 'users' === $name ? false : $provider;
}, 10, 2 );
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.