We’ve all had web design situations where we’ve needed to replace a snippet of text throughout our website. The task of learning how to replace text is a literal right of passage for most new WordPress designers. And I use the term “right of passage” in regard to Googling the term, “how to replace text within WordPress.” In running that search, you’ll likely find yourself going down so many knowledge rabbit holes that you may forget what you were searching for in the first place. Been there! Nowadays, I use the uber awesome plugin, Better Search Replace. I mean it simply does the job so elegantly I sometimes forget there were alternatives. Back in the day, before search and replace plugins were a thing, I recall using a simple bit of text that was all the rage back in 2013. I was a big fan of The Web Taylor Hampshire blog back then and recall geeking out on his blog on numerous occasions. One of the blog posts discussed WordPress: Replace string in content of all pages, gave the following functions.php ready snippet: function replace_content($content) { $content = str_replace('##Replace Me##', '##With Something Else##',$content); return $content;
Share This

We are using cookies on our website

Please confirm, if you accept our tracking cookies. You can also decline the tracking, so you can continue to visit our website without any data sent to third party services.