تابع ووکامرسی wc_get_notices دریافت تمامی هشدار های موجود

تابع ووکامرسی wc_get_notices – دریافت تمامی هشدار های موجود فروشگاه بر اساس نام و نوع
Syntax – سینتکس
(array|mixed) wc_get_notices( (string) $notice_type = '' );
Parameters – پارامتر ها (1)
- 1- $notice_type (string)
Usage – نحوه استفاده
if ( !function_exists( 'wc_get_notices' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-notice-functions.php';
}
// The singular name of the notice type - either error, success or notice. [optional]
$notice_type = '';
// NOTICE! Understand what this does before running.
$result = wc_get_notices($notice_type);
Defined – محل تعریف
/includes/wc-notice-functions.php
function wc_get_notices( $notice_type = '' ) {
if ( ! did_action( 'woocommerce_init' ) ) {
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', woocommerce ), '2.3' );
return;
}
$all_notices = WC()->session->get( 'wc_notices', array() );
if ( empty( $notice_type ) ) {
$notices = $all_notices;
} elseif ( isset( $all_notices[ $notice_type ] ) ) {
$notices = $all_notices[ $notice_type ];
} else {
$notices = array();
}
return $notices;
}
versions – نسخه ها
از نسخه : 2.1
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر