Menampilkan reCAPTCHA hanya pada halaman Contact Form 7

Pertama, install plugin Code Snippets

Kedua, buat snippet baru, kontennya:

add_action('wp_print_scripts', function () {
	global $post;
	if ( is_a( $post, 'WP_Post' ) && !has_shortcode( $post->post_content, 'contact-form-7') ) {
	wp_dequeue_script( 'google-recaptcha' );
	wp_dequeue_script( 'wpcf7-recaptcha' );
	}
});

Selesai, semoga bermanfaat

Referensi:

Add a comment

Exit mobile version