Last active
May 3, 2024 20:08
-
-
Save MaximilianoRicoTabo/fc2e27d097897678eef57c03a5cab69a to your computer and use it in GitHub Desktop.
replace texts with gettext filter
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 | |
/** | |
* replace texts with gettext filter | |
* | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_translate_text( $translated_text, $untranslated_text, $domain) { | |
//if the domain dosn't contains pmpro return the original text | |
if( $domain !== 'paid-memberships-pro' && $domain !== 'pmpro-group-accounts') { | |
return $translated_text; | |
} | |
switch( $untranslated_text ) { | |
case 'Memberships': | |
$untranslated_text = 'Sponsorship'; | |
break; | |
} | |
return $untranslated_text; | |
} | |
add_filter( 'gettext', 'pmpro_translate_text', 4, 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment