Easily Replace Strings in WordPress With Coding Knowledge

While working on a project for client, I needed to replace some of the defaults string that comes with the theme or plugins installed.

Please note that for this project, I needed to replace some of the strings, not to translate all of them. If you’re looking to translate most or all of the strings from WordPress core, theme or plugins, we recommend to check out these articles:

  • How To Localize Your WordPress Website Using Plugins via ElegentThemes
  • How to translate a WordPress theme via ThemeZee

Luckily, I came across one of a kind WordPress plugin called Say what?.

Say What? is a WordPress plugin that allows you to replace default strings from WordPress core, plugins or themes without any coding knowledge. This plugin can translate strings which have been marked for translation. These strings are usually wrapped in _(), _e() or _x(). To replace any string, go to Tools > Text Changes.

For example, I needed to change some strings from WP Job Manager plugin. Here’s one of the strings that I replaced:

replace strings

There are 4 fields of which 3 are required. As you can see from image above, Text Content is optional. For more information about Text domain and Text context, click on the small blue icon. How do I got the info for the other 3 fields? By looking at the plugin’s source code.

I opened up WP Job Manager’s Github Page, used the search form to find for the string and found which file it belongs to. It’s located in WP-Job-Manager / includes / forms / class-wp-job-manager-form-submit-job.php

say what plugin

As you can see, the string is wrapped inside _e(), Edit listing is the string and wp-job-manager is the text domain. Due to the nature of how this plugin works, it only works for themes and plugins that are translation-ready.

Quicktip: Looking at hundreds of lines of codes might scare you but don’t worry, all you need to do is to find the string that need to be replaced. To help you out, if you’re using Windows, hit CTRL + F, key in the string in the search form and hit enter.

We hope this tutorial helped you to do string replacement in WordPress easily without the need to have any coding knowledge.

Leave a Reply

Your email address will not be published. Required fields are marked *