Using the gettext filter – legit or not?
-
Firstly, this is a sensational plugin, many congratulations to everyone involved in its development and support!
Occasionally I need to change the default text to something better suited to my needs. For example on the membership-checkout form I’d like to replace ‘Billing Address’ with ‘Your Details’. This code *seems* to work:
function my_gettext_billing_address($translated_text, $text, $domain) { if($domain == "paid-memberships-pro" && $text == "Billing Address") $translated_text = "Your Details"; //new text here return $translated_text; } add_filter('gettext', 'my_gettext_billing_address', 10, 3);
However I note from another thread that using gettest isn’t recommended for performance reasons. I also wonder if it’s going to break something behind the scenes. So my questions are: is this an acceptable implementation of the filter? If not, is there a better way to use it, or would another strategy (maybe CSS?) be better? All advice very welcome, thanks.
- The topic ‘Using the gettext filter – legit or not?’ is closed to new replies.