Created
April 7, 2022 08:47
-
-
Save wpfullstripe/215a39fdbb23c577d8a6928e9546f262 to your computer and use it in GitHub Desktop.
The fullstripe_thank_you_post_types Wordpress filter
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 | |
/** | |
* A 'fullstripe_thank_you_url_parameters' filter hook example for WP Full Stripe. | |
* It adds the transaction id and the customer's email address as URL parameters to the thank you page URL. | |
* | |
* @param string $postTypes Array of post types returned by previous filters of the chain. | |
* @param array $params with the following keys: | |
* formName => Name of the form to be opened for editing | |
* formType => Type of the form to be opened for editing. Possible values: | |
* inline_payment | |
* checkout_payment | |
* inline_subscription | |
* checkout_subscription | |
* inline_donation | |
* checkout_donation | |
* inline_save_card | |
* checkout_save_card | |
* | |
* @return string Filtered array of post types | |
*/ | |
function thankYouPostTypes( $postTypes, $params ) { | |
$result = $postTypes; | |
if ( false === array_search( 'post', $postTypes ) ) { | |
array_push( $result, 'post' ); | |
} | |
return $result; | |
} | |
add_filter('fullstripe_thank_you_post_types', 'thankYouPostTypes', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment