お問い合わせフォームのページ以外では、Google reCaptchaを用見込まないようにするコード
お問い合わせフォームのページのスラッグが「contact」だった場合。
function load_recaptcha_js() {
if ( ! is_page( 'contact' ) ) {
wp_deregister_script( 'google-recaptcha' );
}
}
add_action( 'wp_enqueue_scripts', 'load_recaptcha_js',100 );