wc_disable_author_archives_for_customers()WC 2.5.0

Disable author archives for customers.

No Hooks.

Return

null. Nothing (null).

Usage

wc_disable_author_archives_for_customers();

Changelog

Since 2.5.0 Introduced.

wc_disable_author_archives_for_customers() code WC 8.7.0

function wc_disable_author_archives_for_customers() {
	global $author;

	if ( is_author() ) {
		$user = get_user_by( 'id', $author );

		if ( user_can( $user, 'customer' ) && ! user_can( $user, 'edit_posts' ) ) {
			wp_safe_redirect( wc_get_page_permalink( 'shop' ) );
			exit;
		}
	}
}