Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kimwhite/7356c3e72545f75612dc74532e8a927a to your computer and use it in GitHub Desktop.
Save kimwhite/7356c3e72545f75612dc74532e8a927a to your computer and use it in GitHub Desktop.
run on front end only
<?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