Skip to content

Instantly share code, notes, and snippets.

@edrdesigner
Created July 2, 2017 21:14
Show Gist options
  • Save edrdesigner/e672d865967bfd4d999d5966c6c535dc to your computer and use it in GitHub Desktop.
Save edrdesigner/e672d865967bfd4d999d5966c6c535dc to your computer and use it in GitHub Desktop.
SELECT DISTINCT(p.ID), p.post_title, p.post_content FROM `wp_posts` p
LEFT JOIN wp_posts im ON p.ID = im.post_parent AND im.post_type = "attachment"
WHERE p.post_status ='publish'
AND p.post_type = "post"
AND im.ID IS NULL
AND p.post_content NOT REGEXP 'src=".*"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment