Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of using the gettext filter to change some address-related strings in PMPro.
/*
Replace some address-related strings in PMPro.
Add this code to a custom plugin.
*/
function gettext_pmpro_checkout_city_state_postcode($translated_text, $original_text, $domain) {
if($domain == 'pmpro' || $domain == 'paid-memberships-pro') {
if($translated_text == 'City, State Zip')
$translated_text = 'City, County, Post Code';
if($translated_text == 'State')
$translated_text = 'County';
if($translated_text == 'Zip' || $translated_text == 'Zipcode')
$translated_text = 'Post Code';
}
return $translated_text;
}
add_filter('gettext', 'gettext_pmpro_checkout_city_state_postcode', 10, 3);
@paulotruta

This comment has been minimized.

Copy link

commented May 11, 2017

I'm using this technique to override strings sucessfully in the theme textdomain, but somehow when trying to override some original strings for the "Formidable Forms" plugin, it is just not working... Any suggestions on this? ;)

@pbrocks

This comment has been minimized.

Copy link

commented May 15, 2018

@paulotruta 'Formidable Forms' will have a different domain. Change that and it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.