Created
February 5, 2018 21:19
-
-
Save joedooley/9f4e87d91180fe274c66b0c41fb74935 to your computer and use it in GitHub Desktop.
Change Stripe API mode for targeted form.
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 | |
/** | |
* Filters the API mode for a specific form to 'test'. | |
* | |
* @param $api_mode string Either 'test' or 'live' | |
* | |
* @return string Returns 'test' for targeted form. Otherwise, | |
* will return the value for the $api_mode setting. | |
*/ | |
add_filter( 'gform_stripe_api_mode', function ( $api_mode ) { | |
// Change $form_id to the id of the form your targeting. | |
$form_id = 1; | |
$form = GFAPI::get_form( $form_id ); | |
if ( $form ) { | |
return 'test'; | |
} | |
return $api_mode; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment