wc_disable_author_archives_for_customers()WC 2.5.0

Disable author archives for customers.

Хуков нет.

Возвращает

null. Ничего (null).

Использование

wc_disable_author_archives_for_customers();

Список изменений

С версии 2.5.0 Введена.

Код wc_disable_author_archives_for_customers() 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;
		}
	}
}