FAQ

Frequently Asked Questions

How to easily replace words in your posts – CodeRevolution

Imagine your blog was named “myblog” and you renamed it “mysuperblog”. Don’t edit your XXX posts to replace every single occurence! This extremely useful tip will do it for you, in just a minute!

Simply put words to replace in the array on line 4. Once done, paste the code into your function.php file, save the file, and you’re done!

 function replace_text_wps($text){     $replace = array(         // 'WORD TO REPLACE' => 'REPLACE WORD WITH THIS'         'wordpress' => '<a href="#">wordpress</a>',         'excerpt' => '<a href="#">excerpt</a>',         'function' => '<a href="#">function</a>'     );     $text = str_replace(array_keys($replace), $replace, $text);     return $text; }  add_filter('the_content', 'replace_text_wps'); add_filter('the_excerpt', 'replace_text_wps'); 

Thanks to Kevin Chard for the cool tip!

CodeRevolution Knowledge Base

Video tutorials