-
-
Save dwanjuki/98d646e561cfd1ff7cfd462d636b174d to your computer and use it in GitHub Desktop.
Disable Contact Form 7 reCAPTCHA on the checkout page for PMPro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * This recipe stops Contact Form 7's reCAPTCHA script from loading | |
| * on the PMPro checkout page. | |
| * | |
| * You can add this recipe to your site by creating a custom plugin | |
| * or using the Code Snippets plugin available for free in the WordPress repository. | |
| * Read this companion article for step-by-step directions on either method. | |
| * https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_disable_contact_form_7_recaptcha_on_checkout() { | |
| // Bail if CF7 or PMPro inactive. | |
| if ( ! defined( 'WPCF7_VERSION' ) || ! function_exists( 'pmpro_is_checkout' ) ) { | |
| return; | |
| } | |
| // Dequeue CF7 reCAPTCHA script if we're on a PMPro Checkout page. | |
| if ( wp_script_is( 'wpcf7-recaptcha', 'enqueued' ) && pmpro_is_checkout() ) { | |
| wp_dequeue_script( 'wpcf7-recaptcha' ); | |
| } | |
| } | |
| add_action( 'wp_print_scripts', 'my_pmpro_disable_contact_form_7_recaptcha_on_checkout' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment