self::SELECTOR, 'action' => self::AJAX_ACTION, 'postArgs' => [ 'nonce' => wp_create_nonce( self::AJAX_ACTION ) ], ]; ob_start(); ?> ', '' ], '', ob_get_clean() ); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'wp-util' ); wp_add_inline_script( 'wp-util', $script ); } /** * Re-enable the CSS Transient caching. * * This is triggered via an AJAX call from the Site Health panel. */ public function reenable_css_transient_caching() { check_ajax_referer( self::AJAX_ACTION, 'nonce' ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( 'Unauthorized.', 401 ); } $result = AMP_Options_Manager::update_option( Option::DISABLE_CSS_TRANSIENT_CACHING, false ); if ( false === $result ) { wp_send_json_error( 'CSS transient caching could not be re-enabled.', 500 ); } wp_send_json_success( 'CSS transient caching was re-enabled.', 200 ); } }