diff --git a/dapper.php b/dapper.php index 7a28dc9..15fb4e3 100644 --- a/dapper.php +++ b/dapper.php @@ -1144,12 +1144,16 @@ add_action( 'plugins_loaded', 'dapper_woo_conditional_load' ); // Late hook – // ──────────────────────────────────────────────── // Contact Form 7 protection (always loaded if CF7 exists) // ──────────────────────────────────────────────── -if ( class_exists( 'WPCF7' ) ) { +if ( get_option('dapper_enable_cf7_protection', 'on') === 'on' ) { // Add hidden fields to Contact Form 7 forms add_filter('wpcf7_form_hidden_fields', 'dapper_cf7_hidden_fields'); function dapper_cf7_hidden_fields($fields) { + if ( ! dapper_cf7_enabled() ) { + return $result; + } + $fields['dapper_ts'] = time(); $fields['dapper_token'] = ''; @@ -1158,6 +1162,10 @@ if ( class_exists( 'WPCF7' ) ) { add_action('wp_footer', 'dapper_cf7_js_token', 100); function dapper_cf7_js_token() { + if ( ! dapper_cf7_enabled() ) { + return $result; + } + if (!defined('WPCF7_VERSION')) return; ?>