Replace content in WordPress on the fly:
function replace_content_on_the_fly($text){ $replace = array( // 'words to find' => 'replace with this' 'wordpress' => '<a href="http://www.wordpress.org/">wordpress</a>', 'google' => '<a href="http://www.google.com/">excerpt</a>', 'function' => '<a href="#">function</a>' ); $text = str_replace(array_keys($replace), $replace, $text); return $text; } add_filter('the_content', 'replace_content_on_the_fly'); add_filter('the_excerpt', 'replace_content_on_the_fly');
I add code to functinon.php but it don't word.
If you update on the fly - you don't need to click on the update button. There is nothing going out ping wise. It also wont update when the page was last updated anywhere.
Will Google know the content has been updated?
Excellent and so very useful indeed. It certainly came in useful to recode some embed codes on a site without needing to wade through the entire site.
Thank you.
Thanks a lot! very useful!
Regards!