Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Last active March 12, 2024 10:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewlimaza/efb91456db379d6a6a54cfb4f8824c9d to your computer and use it in GitHub Desktop.
Save andrewlimaza/efb91456db379d6a6a54cfb4f8824c9d to your computer and use it in GitHub Desktop.
WPML Compatibility for Paid Memberships Pro Checkout.
<?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 );
@andrewlimaza
Copy link
Author

This is built into core now and is no longer needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment