تابع wc_disable_author_archives_for_customers غیر فعالسازی مطالب مشتر

تابع ووکامرسی wc_disable_author_archives_for_customers – غیر فعال سازی مطالب مشتری
Syntax – سینتکس
wc_disable_author_archives_for_customers();
Usage – نحوه استفاده
if ( !function_exists( 'wc_disable_author_archives_for_customers' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-user-functions.php';
}
// NOTICE! Understand what this does before running.
$result = wc_disable_author_archives_for_customers();
Defined – محل تعریف
/includes/wc-user-functions.php
function wc_disable_author_archives_for_customers() {
global $wp_query, $author;
if ( is_author() ) {
$user = get_user_by( 'id', $author );
if ( isset( $user->roles[0] ) && 'customer' === $user->roles[0] ) {
wp_redirect( wc_get_page_permalink( 'shop' ) );
}
}
}
versions – نسخه ها
از نسخه : 2.5.0
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر