Forked from andrewlimaza/pmpro-ipn-redirect.php
Last active
September 24, 2025 14:08
-
-
Save kimwhite/51b851547f3d86924762aad4cb5055f5 to your computer and use it in GitHub Desktop.
Post IPN data to multiple URLs example [Paid Memberships Pro]
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 | |
| /** | |
| * Needs testing | |
| * Forward PayPal IPN from WooCommerce to PMPro's IPN handler. | |
| * Drop this into a custom plugin or your theme's functions.php. | |
| */ | |
| function my_pmpro_forward_ipn_from_woo() { | |
| // Forward the raw POST data from Woo's IPN to PMPro. | |
| $response = wp_remote_post( | |
| admin_url('admin-ajax.php?action=ipnhandler'), | |
| array( | |
| 'body' => wp_unslash($_POST), | |
| 'timeout' => 15, | |
| 'sslverify' => false, | |
| ) | |
| ); | |
| // Optionally log response for debugging | |
| if ( is_wp_error( $response ) ) { | |
| error_log( 'PMPro IPN Forwarding Failed: ' . $response->get_error_message() ); | |
| } else { | |
| error_log( 'PMPro IPN Forwarded Successfully: ' . wp_remote_retrieve_body( $response ) ); | |
| } | |
| } | |
| add_action( 'woocommerce_api_wc_gateway_paypal', 'my_pmpro_forward_ipn_from_woo' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment