How to Change Any Text in WordPress – Core, Plugin and Theme

I haven’t ever found someone who wants to change the texts of WordPress core. But most of the developers does not like the wordings found in a theme or plugin. Even an UX researcher might want to change some text for the users to have better understanding of the features.

If you don’t know about translations, you might go for changing the source code. But that is not a good practice! Because, the changes will be lost upon update and if you do not know the other way, you will end up editing the source over and over again! So the question is, “what is the best practice, which will save me from banging my head on the wall each time there is an update?”

The best practice for translations

Wait, why am I mentioning translation here?

For those who have never worked with WordPress translation or internationalization, it is a process which does not involve touching source code and the safest place to keep your text for ages. If you already know about translating a theme or plugin, please skip this section and move on to the next paragraph.

Most of the plugin and theme authors put their language file inside the .zip file. The translations work from there too and the location is like wp-content/plugins/pluginName/languages/.

The translation file type will be POT or PO and the file extension would be .po or .pot. You can open that file using Poedit, or use a plugin like WPML or qTranslate. I will be using Poedit; because it is works on all the major operating system, free and easy for all kind of users.

Download and install Poedit and open the .po or .pot file. Change the texts you want and hit save the translations. Upon save, Poedit will generate an extra file, which is MO and the extension would be .mo. That is a machine readable file and WordPress will read that to replace the texts in the system.

So we can put that file in the very same location where is the plugin is located. Like wp-content/plugins/pluginName/languages/. But doing that is equally harmful as editing the source code. Because this file will be erased upon update.

How to Make the Change Update Proof?

If we place the translation file inside the `wp-content/languages/plugins/` then it will be update proof and will stay there as is till the end of time.

If can not find the `wp-content/languages/` folder. Don’t worry, it will not be there by default. You have to create it manually.

I have modified some texts of a plugin named WP User Frontend so the file location is wp-content/languages/plugins/wpuf-en_US.mo. Here, wpuf is the text domain of the plugin.

So this is it. Let me know if have successfully completed the job. If you get confused in between any step, and need more clarification from me. Feel free to let me know in the comments section 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.