How to quickly find and edit code from themes and plugins

Working with WordPress can be easy. When compared to many other content management systems, it really is easy. Even you if you have nothing to do with the code or design, you can still have your WordPress site up and running, and you can start writing and publishing content in a matter of minutes. If you need to extend your WordPress site, you can do that by installing some of the millions of plugins and themes available on the Internet.

But if you get a bit more serious about your site, sooner or later you will need to customize a thing or two. No matter how good a theme or plugin is, how many options do you get with it, it simply isn’t possible to make everything editable. For example, you will be able to change a title and some important buttons, but how do you make a change if a particular element can’t be changed via Customizer and theme’s/plugin’s options? You modify it yourself.

Depending on how much you know about WordPress, modifying files can be a two-minute job, or it may crash your entire site after spending hours on customization. Before you start modifying the file, please make sure that you’re aware of what you’re doing and that you always have a backup safely placed in a folder outside of your server.

If you have decided it’s time for modifications, you might get stuck on a first step – finding the correct file where the code is located. Since WordPress consists of dozens of different files, a beginner might have trouble finding them. WordPress developers don’t have a problem with that because they already know the Template Hierarchy by heart. But if you’re not that interested in coding, you should know about these plugins which can help you a lot.

What the File

PRICE: Free

What the File

Once you get behind the idea that the abbreviation for this plugin is WTF, you will see how cool the plugin really is. Once you install and activate it, What the File will create a simple menu item directly on your toolbar, right next to your username and your cool photo. If you now open any page on your site, you will be able to hover over the What the File menu item and the plugin will tell you which template parts have been used to create that particular page.

The plugin will allow you to click on the template name which will then lead you to the edit page. While this can be great to make small changes, be very careful if editing template files directly from WordPress.

As you can already see, the plugin is fairly straightforward, but it can help you to identify template parts which you want to modify quickly. The rest is up to you. That’s why we want to introduce another free plugin which can help you even more.

String Locator

PRICE: Free

String Locator

When finding the right template isn’t enough, String Locator is here to help. Imagine that you want to modify a specific HTML element in your theme or any plugin you have installed. You can quickly locate the element by inspecting it through your browser, but you will still have problems finding out the file which rendered that element. Since you’re now working with custom themes and plugins, files may have different names from what you’re used to. A developer might have placed a code in a separate file to make thing easier for further development, and you can get stuck on searching the code through hundreds of files. Instead, you can use String Locator.

If you choose to use this plugin, you won’t have to worry about which template is being used to produce the particular string you are searching for.

Whether you’re searching for a word, entire phrase or a piece of code, this plugin will be able to find it.

All you have to do is navigate to Tools -> String Locator and start searching. The plugin will then scan through all the theme and plugin files you have installed, and it will find the search term. You can even select the specific theme/plugin for the plugin to search through.

After you hit the Search button and allow a few seconds for String Locator to do its magic, the results will show you the string, file where it’s located and a line number. Thig,; the plugin will let you edit that specific file, and it will immediately highlight your search phrase!

Now you can change any part of any theme/plugin, you can translate the hardcoded parts of them and you can forget about manually scanning through files which are unknown to you.


While these WordPress tools can help you a lot, we still suggest that you take care of your site. If you’re not completely sure what changes are you making, make sure that you always have a fresh backup and consider hiring a professional to do the work for you. Also, take note that many developers won’t be able to help you if you make mistakes by modifying a theme or a plugin on your own.

START YOUR OWN BLOG

This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

One thought on “How to quickly find and edit code from themes and plugins

  1. […] How to quickly find and edit code from themes and plugins: These two free plugins will make it a lot easier for you to locate which WordPress file to edit. […]

Leave a Reply

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