diff --git a/includes/functions/settings/_register_settings.php b/includes/functions/settings/_register_settings.php index 06feabd7..e8502846 100644 --- a/includes/functions/settings/_register_settings.php +++ b/includes/functions/settings/_register_settings.php @@ -611,16 +611,23 @@ define( 'FICTIONEER_OPTIONS', array( 'fictioneer_flush_object_cache' => array( 'name' => 'fictioneer_flush_object_cache', 'group' => 'fictioneer-settings-general-group', - 'sanitize_callback' => 'fictioneer_sanitize_disable_widget_checkbox', + 'sanitize_callback' => 'fictioneer_sanitize_checkbox', 'label' => __( 'Flush object cache on content updates', 'fictioneer' ), 'default' => false ), 'fictioneer_see_some_evil' => array( 'name' => 'fictioneer_see_some_evil', 'group' => 'fictioneer-settings-general-group', - 'sanitize_callback' => 'fictioneer_sanitize_disable_widget_checkbox', + 'sanitize_callback' => 'fictioneer_sanitize_checkbox', 'label' => __( 'Monitor posts for suspicious content', 'fictioneer' ), 'default' => false + ), + 'fictioneer_enable_fast_ajax_comments' => array( + 'name' => 'fictioneer_enable_fast_ajax_comments', + 'group' => 'fictioneer-settings-general-group', + 'sanitize_callback' => 'fictioneer_sanitize_checkbox', + 'label' => __( 'Enable fast AJAX for comments', 'fictioneer' ), + 'default' => false ) ), 'integers' => array( diff --git a/includes/functions/settings/_settings_page_general.php b/includes/functions/settings/_settings_page_general.php index 4f42e470..faf23f4e 100644 --- a/includes/functions/settings/_settings_page_general.php +++ b/includes/functions/settings/_settings_page_general.php @@ -563,7 +563,18 @@ value="1">
-

+

+
+ + + @@ -658,7 +669,7 @@
- +

diff --git a/mu-plugins/fictioneer_001_fast_requests.php b/mu-plugins/fictioneer_001_fast_requests.php index 1aefb88a..c7879f8f 100644 --- a/mu-plugins/fictioneer_001_fast_requests.php +++ b/mu-plugins/fictioneer_001_fast_requests.php @@ -14,14 +14,23 @@ if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) && isset( $_REQUEST['fcn_fast_ajax'] ) && - isset( $_REQUEST['action'] ) && - strpos( $_REQUEST['action'], 'fictioneer_ajax' ) === 0 + strpos( $_REQUEST['action'] ?? '', 'fictioneer_ajax' ) === 0 ) { add_filter( 'option_active_plugins', 'fictioneer_exclude_plugins' ); } $request_uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); +// Check if AJAX comment request +if ( + get_option( 'fictioneer_enable_fast_ajax_comments' ) && + ( defined( 'DOING_AJAX' ) && DOING_AJAX ) && + strpos( $_REQUEST['action'] ?? '', 'fictioneer_ajax' ) === 0 && + strpos( $_REQUEST['action'] ?? '', 'comment' ) !== false +) { + add_filter( 'option_active_plugins', 'fictioneer_exclude_plugins' ); +} + // Check REST Request if ( strpos( $request_uri, 'wp-json/fictioneer/' ) !== false ) { add_filter( 'option_active_plugins', 'fictioneer_exclude_plugins' );