Replacing Text: Plugin or Theme

Being able to replace text in WordPress themes or plugins is very useful.

Here is Jeff Star on how to replace all instances of a string in WordPress. As he says, nothing is actually changed in the database — it’s only changed when output to the browser.

function replace_text($text) {
	$text = str_replace('look-for-this-string', 'replace-with-this-string', $text);
	$text = str_replace('look-for-that-string', 'replace-with-that-string', $text);
	return $text;
}
add_filter('the_content', 'replace_text');`

And this is all well and good, but assumes you know how to find the string and find it unambiguously.

Say What? Plugin

Being able to replace text in WordPress without being a developer is very handy, and bearing in mind the credentials of the author of the ‘Say What’ plugin author, feels safe. Lee Willis, the author is a WordPress core contributor. What this plugin does is enable you to replace text that is part of a plugin or theme with your desired text.

The free version is in the WordPress repository. What you need to do if you are using it is to go find the text string you want to replace. And that is not easy if you are not a developer, which is where we started.

The pro version of Say What will help you to find the original text with autocomplete once you start typing. And in the demo video of the pro version, it works very well. I am thinking about getting the pro version, which is $39.00 for a single site and $69 for multiple sites. The information on the site says that the cost for renewal will be 50% of the purchase price at time of renewal.

The only downside I can think of is that it really needs the plugin to be activated in order for the search and replace to work. It would be neat if it output a php snippet that one could add. I guess that would enable someone to buy a single site licence and then circulate it among multiple sites, but the relatively low cost maybe makes that unlikely. Still, I think it’s a good idea and I might mention it to the developer.