WordPress – redirecting the user for restricting the author archive pages


Below is the function for redirecting the user for restricting the author archive pages, please add to current_theme/functions.php, this will redirect to the home url.


function author_archive_redirect() {

if( is_author() ) {

wp_redirect( home_url(), 301 );

exit;

}

}

add_action( 'template_redirect', 'author_archive_redirect' );

Special Thanks : Supriya Surve

Share on Facebook




About Pragnesh Karia

Pragnesh Karia, Open Source Enthusiast, Software Professional, Software Developer, Technical Lead ,Magento, Joomla ,Joomla LMS , Moodel LMS ,PHP ,Mysql, Ajax, Javascript, Jquery, Linux, Fan of Open Sources , Annet Technologies , SEO Analyst , Mootools