WordPress – Find text within all posts

wordpress blue and white and grey logo

Last updated on March 30th, 2023 at 05:44 pm

Read Time:2 Minute, 3 Second

We recently started to update all of our old posts that contained our old domain name of techygeekshome.co.uk.

To do this, we needed to find all of the posts that actually have this in both the post content itself and also any links or code within the source of the post.

This could have been a painstaking process but we used a method of getting the information we required from our WordPress database using phpMyAdmin and a simple SQL query.


If you want to get a list of posts that has a set of text within it, then you can follow our simple guide.

Please note: You should always backup your database before doing anything – you mess it up, do not blame us!

You should first of all login to your cPanel and then get into your phpMyAdmin portal. From here you need to click into your database for your WordPress installation of the left hand side.

Once you are in the correct database, click on the SQL tab:

phpMyAdmin SQL Tab
Click to enlarge

Then in the query box below it, you should type in this query:

SELECT * FROM wp_posts WHERE post_content LIKE '%techygeekshome.co.uk%'


  • wp_posts = the name of your posts table
  • ‘%techygeekshome.co.uk%’ = the text that you want to find in the WordPress database

You should then press the Go button at the bottom right:

phpMyAdmin Query Box
Click to enlarge

This will then go off and find all the posts with the stated text in it:

phpMyAdmin Results Posts
Click to enlarge

Now you have pulled the data from the SQL database, you now can export that data to CSV format so that you can open it in Excel.

Just tick the Show all tick box:

phpMyAdmin show all rows
Click to enlarge

If you get a popup warning you about it pulling a lot of data, just click on the OK button:

phpMyAdmin Pop Up Box
Click to enlarge

Then scroll to the bottom of the page and you will see the Export option:

phpMyAdmin Export Option
Click to enlarge

This will then take you to the exporting page options, from the drop down menu you can select CSV and click the Go button:

phpMyAdmin Export Options
Click to enlarge

This will then export the data in to a CSV file which you can now go ahead and open in Excel.


If you have any questions or comments on this guide, please feel free to leave us a message below in our comments section.

Avatar for Andrew Armstrong

About Post Author

Andrew Armstrong

Founder of TechyGeeksHome and Head Editor for over 15 years! IT expert in multiple areas for over 23 years. Sharing experience and knowledge whenever possible! Making IT Happen.
Click to rate this post!
[Total: 0 Average: 0]

Free Subscription

If you want to be notified when we post more quality guides like this one, sign up to our free subscription service and you will receive an email when a new post is live.

Join 555 other subscribers.

No need to worry, we will not be filling your inbox with spam and you can unsubscribe anytime you like.

Leave us a message...

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