diff --git a/src/WPDesk/Notice/AjaxHandler.php b/src/WPDesk/Notice/AjaxHandler.php index fd864cf2077da32bc5645c5f18226b0afc0d112a..64c9b7141b4bdc34ef6c2725831842ef26e3240a 100644 --- a/src/WPDesk/Notice/AjaxHandler.php +++ b/src/WPDesk/Notice/AjaxHandler.php @@ -78,8 +78,8 @@ class AjaxHandler implements HookablePluginDependant { if ( isset( $_POST[ self::POST_FIELD_NOTICE_NAME ] ) ) { $noticeName = sanitize_text_field( $_POST[ self::POST_FIELD_NOTICE_NAME ] ); - $option_name = PermanentDismissibleNotice::OPTION_NAME_PREFIX . $noticeName; - check_ajax_referer( $option_name, self::POST_FIELD_SECURITY ); + $optionName = PermanentDismissibleNotice::OPTION_NAME_PREFIX . $noticeName; + check_ajax_referer( $optionName, self::POST_FIELD_SECURITY ); if ( ! current_user_can( 'edit_posts' ) ) { wp_send_json_error(); @@ -91,10 +91,8 @@ class AjaxHandler implements HookablePluginDependant { $source = null; } - $option_name = PermanentDismissibleNotice::OPTION_NAME_PREFIX . $noticeName; - update_option( - $option_name, + $optionName, PermanentDismissibleNotice::OPTION_VALUE_DISMISSED ); do_action( 'wpdesk_notice_dismissed_notice', $noticeName, $source );