inovve

Wordpress Author Page redirect

Dec 17th, 2019
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.36 KB | None | 0 0
  1. add_action('template_redirect', 'my_custom_disable_author_page');
  2.  
  3. function my_custom_disable_author_page() {
  4.     global $wp_query;
  5.  
  6.     if ( is_author() ) {
  7.         // Redirect to homepage, set status to 301 permenant redirect.
  8.         // Function defaults to 302 temporary redirect.
  9.         wp_redirect(get_option('home'), 301);
  10.         exit;
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment