WordPress – Find text within all posts
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:
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:
This will then go off and find all the posts with the stated text in it:
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:
If you get a popup warning you about it pulling a lot of data, just click on the OK button:
Then scroll to the bottom of the page and you will see the Export option:
This will then take you to the exporting page options, from the drop down menu you can select CSV and click the Go button:
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.