wc_disable_author_archives_for_customers()
Disable author archives for customers.
No Hooks.
Returns
null. Nothing (null).
Usage
wc_disable_author_archives_for_customers();
Changelog
| Since 2.5.0 | Introduced. |
wc_disable_author_archives_for_customers() wc disable author archives for customers code WC 10.6.2
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;
}
}
}