Created
May 18, 2018 11:07
-
-
Save nessthehero/4ba39b620b502903a169e238a7bce41b to your computer and use it in GitHub Desktop.
WordPress - Find posts without meta key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM wp_posts as posts | |
WHERE posts.post_type = 'post' | |
AND NOT EXISTS ( | |
SELECT * FROM `wp_postmeta` | |
WHERE `wp_postmeta`.`meta_key` = "your_meta_key" | |
AND `wp_postmeta`.`post_id`=posts.ID | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment