How to Quickly Find and Edit Code From Themes and Plugins

Ogi Djuraskovic
Updated: October 4th, 2023
3 min read
FirstSiteGuide is supported by our readers. When you purchase via links on our site we may earn a commission. Read More
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 if you have nothing to do with the code or design, you can still create your WordPress blog, and you can start writing and publishing content in a matter of minutes. If you need to extend your WordPress blog, 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 files, 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.

String Locator plugin


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, an 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. 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 that 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.

3 comments on “How to Quickly Find and Edit Code From Themes and Plugins”

  1. zakaria yddi

    Thank you very much

  2. Sal

    Thank you. This info was a great help !

  3. Weekly Roundup of Web Design and Development Resources: October 7, 2016

    […] 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 *

Send this to a friend