Last active
March 12, 2024 10:38
-
-
Save andrewlimaza/efb91456db379d6a6a54cfb4f8824c9d to your computer and use it in GitHub Desktop.
WPML Compatibility for Paid Memberships Pro Checkout.
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 | |
/** | |
* Adds support for plugins like WPML that create pages for translation. | |
* Improves the pmpro_is_checkout() calls to try and make it 'smarter'. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_wpml_checkout_compat( $is_checkout ) { | |
// If we're already on checkout, just bail. | |
if ( $is_checkout ) { | |
return $is_checkout; | |
} | |
$level = pmpro_getLevelAtCheckout(); | |
if ( isset( $level->id ) ) { | |
$is_checkout = true; | |
} | |
return $is_checkout; | |
} | |
add_filter( 'pmpro_is_checkout', 'my_pmpro_wpml_checkout_compat', 20, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is built into core now and is no longer needed.