-
-
Save femiyb/32af60cd5cf03db6937d66d38d0b92e2 to your computer and use it in GitHub Desktop.
Disable Contact Form 7's recaptcha on the checkout page for PMPro. #pmpro #paid-memberships-pro #wpcf7 #cf7 #recaptcha
This file contains 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 javascript from loading | |
* on the PMPro checkout page. This helps prevent conflicts from recaptcha | |
* being loaded twice. | |
* | |
* 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 disable_cf7_recaptcha_on_pmpro_checkout() { | |
global $pmpro_pages, $recaptcha; | |
if ( defined( 'WPCF7_VERSION' ) && is_page( $pmpro_pages['checkout'] ) && $recaptcha ) { | |
wp_dequeue_script( 'google-recaptcha' ); | |
} | |
} | |
add_action( 'wp_print_scripts', 'disable_cf7_recaptcha_on_pmpro_checkout' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment