How to Quickly Search for a Code Text String on Entire WordPress Website


How to Quickly Search for a Code Text String on Entire WordPress Website

I recently was trying to optimize my WordPress site performance and noticed a javascript error saying jQuery is not defined. Basically, there was a script that was loading before jQuery was loaded. I searched my entire theme but could not find the code. I then thought of searching all of my plugins for the code. I tried downloading my site and it was taking forever to download the files.

Then I thought, I wonder if this could be done on the server in Cpanel. I then found this article with an SSH command to search all contents of a folder. I am not a terminal wiz and didn’t want to take the time to setup Putty so then found you can access the terminal inside of Plex Cpanel.

Below is the command I ran in the terminal to find the string I was looking for. In my case it was '.add_to_cart_button:not(.product_type_variable, .product_type_grouped)'

The terminal command
grep -Ri 'your string' 'public_html/your-folder/'

 

 


About the Author

Jacob Lett (Jake) is the founder of Bootstrap Creative, a B2B marketing consultancy specializing in manufacturers and industrial companies. A HubSpot-certified CMS developer, SEO, Answer Engine Optimization (AEO), and RevOps professional, he helps B2B companies improve their websites, search visibility, HubSpot systems, and Google Ads campaigns to generate more qualified leads and RFQs. With over a decade of hands-on experience, he acts as a direct partner for companies seeking measurable ROI from their marketing investment.



Related posts
Category: Code Snippets

Tags: ,

| Read My Editorial Policy

Want to Get Email Updates of New Articles?

Join My Email Newsletter