Skip to content

Instantly share code, notes, and snippets.

@robwent
Created April 6, 2016 21:16
Show Gist options
  • Save robwent/9db8579c177f6e08ad2ba9928d5e77f7 to your computer and use it in GitHub Desktop.
Save robwent/9db8579c177f6e08ad2ba9928d5e77f7 to your computer and use it in GitHub Desktop.
Select Wordpress posts that contain a string in PhpMyAdmin
-- Change wp_ to your database prefix
-- Change domain.com to your domain
-- Change string to the text you want to search for
SELECT
ID as 'Post ID',
post_title as 'Title',
CONCAT('http://www.domain.com/',post_name) as 'URL'
FROM `wp_posts`
WHERE post_type = 'post'
AND post_title != 'Auto Draft'
AND post_content LIKE '%string%'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment