WC_Admin_Notices::hide_notices() public WC 1.0
Hide a notice if the GET variable is set.
{} Это метод класса: WC_Admin_Notices{}
Хуки из метода
Возвращает
Null. Ничего.
Использование
$result = WC_Admin_Notices::hide_notices();
Код WC_Admin_Notices::hide_notices() WC Admin Notices::hide notices WC 5.0.0
public static function hide_notices() {
if ( isset( $_GET['wc-hide-notice'] ) && isset( $_GET['_wc_notice_nonce'] ) ) { // WPCS: input var ok, CSRF ok.
if ( ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wc_notice_nonce'] ) ), 'woocommerce_hide_notices_nonce' ) ) { // WPCS: input var ok, CSRF ok.
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
}
if ( ! current_user_can( 'manage_woocommerce' ) ) {
wp_die( esc_html__( 'You don’t have permission to do this.', 'woocommerce' ) );
}
$hide_notice = sanitize_text_field( wp_unslash( $_GET['wc-hide-notice'] ) ); // WPCS: input var ok, CSRF ok.
self::remove_notice( $hide_notice );
update_user_meta( get_current_user_id(), 'dismissed_' . $hide_notice . '_notice', true );
do_action( 'woocommerce_hide_' . $hide_notice . '_notice' );
}
}