wc_disable_author_archives_for_customers()
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() wc disable author archives for customers code WC 9.3.3
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; } } }