Last active
February 14, 2020 08:42
-
-
Save rvdsteege/c82cc3efae5f62fb42bdbd692ab9cd04 to your computer and use it in GitHub Desktop.
Snippet to customise the Pronamic Pay cancel redirect URL.
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 | |
/** | |
* Pronamic Pay custom subscription cancel redirect URL. | |
*/ | |
add_action( 'pronamic_subscription_status_update_gravityformsideal', 'pronamic_pay_subscription_cancel_redirect_url', 10, 1 ); | |
function pronamic_pay_subscription_cancel_redirect_url( $subscription ) { | |
$redirect_url = home_url(); | |
if ( ! filter_has_var( INPUT_GET, 'subscription' ) || ! filter_has_var( INPUT_GET, 'action' ) || ! filter_has_var( INPUT_GET, 'key' ) ) { | |
return; | |
} | |
if ( \Pronamic\WordPress\Pay\Subscriptions\SubscriptionStatuses::CANCELLED !== $subscription->get_status() ) { | |
return; | |
} | |
wp_redirect( esc_url( $redirect_url ) ); | |
exit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment