Have you ever wanted to locate something within one or more of your posts, but been unable to remember exactly where you’d placed it? You can use the WordPress dashboard search of course, but if that doesn’t help, you can try a more thorough search of the WordPress posts database table using MySQL.
If this article helps you, please help me by clicking one or more of the social media buttons on the left. Thank you!
Step By Step Instructions To Search The WordPress Posts Table
I am using my Hostgator account to demonstrate this, but any cPanel hosting account will be the same.
Step 1 – Log into my hosting account
Once logged into your cPanel, click in the phpMyAdmin symbol in the database section of the cPanel dashboard.
Step 2 – Find the correct WordPress database
Locate the right WordPress database for your site – you may have more than one WordPress database on your hosting account. You do this by issuing the following SQL query to each database until you find the right one.
SELECT option_value FROM wp_options WHERE option_name = 'blogname'
Step 3 – Log into my hosting account
Decide what it is you are searching for. If it is a link you could choose a short unique portion of it that you know wold only appear in the link and nowhere else. Whatever string you are searching for, replace the words your search string, in the SQL query below.
SELECT id, post_title, post_status, post_type, SUBSTR(post_content, LOCATE('your search string', post_content) -1, 100) FROM wp_posts WHERE locate('your search string', post_content) > 0
This will reveal any posts, pages, revisions or trashed items that contain your string.