$plugin ) { if ( ! in_array( $plugin, $allow_list ) && strpos( $plugin, 'fictioneer' ) === false ) { unset( $plugins[ $index ] ); } } // Continue filter return $plugins; } // Check if AJAX comment request if ( get_option( 'fictioneer_enable_fast_ajax_comments' ) && defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_REQUEST['fcn_fast_comment_ajax'] ) ) { add_filter( 'option_active_plugins', 'fictioneer_exclude_plugins_while_commenting' ); } /** * Filters the list of active plugins when commenting * * @since 1.0.0 * * @param array $plugins An array of active plugin paths. * * @return array Filtered array of active plugins. */ function fictioneer_exclude_plugins_while_commenting( $plugins ) { // Setup $allow_list = array( 'w3-total-cache/w3-total-cache.php', // W3 Total Cache 'wp-super-cache/wp-cache.php', // WP Super Cache 'wp-rocket/wp-rocket.php', // WP Rocket 'litespeed-cache/litespeed-cache.php', // LiteSpeed Cache 'wp-fastest-cache/wpFastestCache.php', // WP Fastest Cache 'cache-enabler/cache-enabler.php', // Cache Enabler 'hummingbird-performance/wp-hummingbird.php', // Hummingbird 'wp-optimize/wp-optimize.php', // WP-Optimize - Clean, Compress, Cache 'sg-cachepress/sg-cachepress.php', // SG Optimizer (SiteGround) 'breeze/breeze.php', // Breeze (by Cloudways) 'nitropack/nitropack.php' // NitroPack ); // Filter and continue return array_intersect( $plugins, $allow_list ); }