Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dwanjuki/98d646e561cfd1ff7cfd462d636b174d to your computer and use it in GitHub Desktop.
Save dwanjuki/98d646e561cfd1ff7cfd462d636b174d to your computer and use it in GitHub Desktop.
Disable Gravity Form's reCAPTCHA on the checkout page for PMPro
<?php
/**
* This recipe stops Gravity Form'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_gravity_forms_recaptcha_on_pmpro_checkout() {
if ( function_exists( 'pmpro_is_checkout' ) && pmpro_is_checkout() && wp_script_is( 'gform_recaptcha', 'enqueued' ) ) {
wp_dequeue_script( 'gform_recaptcha' );
}
}
add_action( 'wp_print_scripts', 'disable_gravity_forms_recaptcha_on_pmpro_checkout' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment