Skip to content

Instantly share code, notes, and snippets.

@sjaved87
Created June 7, 2016 21:35
Show Gist options
  • Save sjaved87/112cb175a9f303547c0e0186db5594a0 to your computer and use it in GitHub Desktop.
Save sjaved87/112cb175a9f303547c0e0186db5594a0 to your computer and use it in GitHub Desktop.
Use below code to change the text on anywhere (restrict it with text domain name) on your WordPress Single Site or Multisite.
<?php
add_filter('gettext', 'sjaved_change_text_dynamically', 99, 3);
if(function_exists('sjaved_change_text_dynamically')) :
function sjaved_change_text_dynamically( $translated_text, $untranslated_text, $domain ){
if($domain == 'YourTextDomain' and $untranslated_text == 'YourText' ){
$translated_text = 'ReplacedText';
}
return $translated_text;
}
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment