Hi, I am writing a small super handy script to change any standard text of WordPress framework that will make your life easy for editing the theme, Woocommerce, or any plugin word all over the website with just 1 Step.
So I don’t want to write any more on it giving you guys extra data on SEO simple copy paste and modify it to your own way.
#change any text from and to - will work with standard names
add_filter('gettext', 'translate_text');
add_filter('ngettext', 'translate_text');
function translate_text($translated) {
$translated = str_ireplace('Text that is to be replaced', 'Text to be replaced with', $translated);
return $translated;
Example to help you understand better
#change any text from and to - will work with standard names
add_filter('gettext', 'translate_text');
add_filter('ngettext', 'translate_text');
function translate_text($translated) {
$translated = str_ireplace('My Account', 'Personal Dashboard', $translated);
return $translated;
So the above code will change your My Account to Personal Dashboard
As I always say If you have a favorite WordPress snippet that you like to use please share it in the comments below.
Also Read: WordPress Easy Guide on Code Snippets and don’t forget 10 Useful Code Snippets for every WordPress Users