Forked from andrewlimaza/my_pmpro_text_translation.php
Last active
August 26, 2025 14:55
-
-
Save kimwhite/7356c3e72545f75612dc74532e8a927a to your computer and use it in GitHub Desktop.
run on front end only
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 // do not copy this line. | |
/** | |
* This recipe changes term "membership" to "subscription" for plugin generated text Front End only | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_gettext_membership($translated_text, $text, $domain) | |
{ | |
// Only run on front end, not in admin or AJAX. | |
if ( is_admin() || wp_doing_ajax() ) { | |
return $translated_text; | |
} | |
if ( $domain === "paid-memberships-pro" ) { | |
$translated_text = str_replace("Membership", "Subscription", $translated_text); | |
$translated_text = str_replace("membership", "subscription", $translated_text); | |
} | |
return $translated_text; | |
} | |
add_filter("gettext", "my_pmpro_gettext_membership", 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment