wc_print_notice() WC 2.1
Print a single notice immediately.
Хуки из функции
Возвращает
Null. Ничего.
Использование
wc_print_notice( $message, $notice_type, $data );
- $message(строка) (обязательный)
- The text to display in the notice.
- $notice_type(строка)
- The singular name of the notice type - either error, success or notice.
- $data(массив)
- Optional notice data. @since 3.9.0.
Список изменений
С версии 2.1 | Введена. |
Код wc_print_notice() wc print notice WC 5.0.0
function wc_print_notice( $message, $notice_type = 'success', $data = array() ) {
if ( 'success' === $notice_type ) {
$message = apply_filters( 'woocommerce_add_message', $message );
}
$message = apply_filters( 'woocommerce_add_' . $notice_type, $message );
wc_get_template(
"notices/{$notice_type}.php",
array(
'messages' => array( $message ), // @deprecated 3.9.0
'notices' => array(
array(
'notice' => $message,
'data' => $data,
),
),
)
);
}