← All posts
12 January 2024

Finding hardcoded text in WordPress with String Locator

Some stubborn bit of text isn't in any setting, page or widget - it's hardcoded in a theme or plugin file. Here's how to track it down in seconds with String Locator.

You’ve checked the page, the widget, the customiser, the theme options - and that one line of text still won’t change. That usually means it’s hardcoded directly into a theme or plugin file, often by a previous developer who left no documentation. Hunting through dozens of PHP files by hand is miserable. String Locator turns it into a 30-second search.

What String Locator does

It searches every file across your themes, plugins and WordPress core for any string - text, a shortcode, a snippet of code, a URL - and shows you exactly which file and line it lives on. It’s a free plugin from the WordPress repository, and it’s the first thing we reach for when working on an unfamiliar site full of undocumented surprises.

How to use it

  1. Install and activate String Locator from Plugins → Add New.
  2. Go to Tools → String Locator in your dashboard.
  3. Choose where to search - the active theme, all themes, all plugins, a specific plugin, or WordPress core. Narrowing the scope makes the search faster.
  4. Enter the string you’re looking for and run it.
  5. Read the results - String Locator lists every matching file with the line number and a preview of the surrounding code, so you can jump straight to it.

A serious word of caution

String Locator offers an in-browser editor so you can change the file right from the search results. It’s convenient and it’s also a great way to take a live site down. Editing PHP directly means one stray character can trigger a fatal error on the whole site.

Before you edit anything:

  • Back up the site first - files and database.
  • Never edit a parent theme directly. Your changes vanish on the next update. Use a child theme or a code snippet instead.
  • Prefer the right fix over the fast one. Hardcoded text often belongs in a translation file, a customiser setting, or a proper template override - not patched in place.
  • If you’re not certain, don’t. A fatal error from a misplaced semicolon isn’t worth it.

String Locator is brilliant for finding things. Use something safer - SFTP, a staging site, version control - for actually changing them.


Stuck with a site nobody documented, where things change in places they shouldn’t? Finding and untangling that kind of mess is one of our specialities.

Tell us what’s broken.
We’ll tell you the truth.

Book a free call →
Reply within one business day ¡ EN / LV