Skip to content

Instantly share code, notes, and snippets.

@MaximilianoRicoTabo
Last active May 3, 2024 20:08
Show Gist options
  • Save MaximilianoRicoTabo/fc2e27d097897678eef57c03a5cab69a to your computer and use it in GitHub Desktop.
Save MaximilianoRicoTabo/fc2e27d097897678eef57c03a5cab69a to your computer and use it in GitHub Desktop.
replace texts with gettext filter
<?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