wc_disable_author_archives_for_customers

Disable author archives for customers.

Description

wc_disable_author_archives_for_customers(); 

Usage

  1. if ( !function_exists( 'wc_disable_author_archives_for_customers' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-user-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wc_disable_author_archives_for_customers(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-user-functions.php  
  1. function wc_disable_author_archives_for_customers() { 
  2. global $wp_query, $author; 
  3.  
  4. if ( is_author() ) { 
  5. $user = get_user_by( 'id', $author ); 
  6.  
  7. if ( isset( $user->roles[0] ) && 'customer' === $user->roles[0] ) { 
  8. wp_redirect( wc_get_page_permalink( 'shop' ) );