Created
May 18, 2020 17:47
-
-
Save bookchiq/292d9ccfdcc7ab4d153022289ce329a9 to your computer and use it in GitHub Desktop.
Find WordPress posts that are missing a specific custom field/postmeta
This file contains hidden or 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 | |
| WHERE | |
| post_type = "ycd_individual" AND | |
| post_status = "publish" AND | |
| ID NOT IN ( | |
| SELECT wp.ID | |
| FROM wp_posts wp | |
| LEFT JOIN wp_postmeta pm ON wp.ID = pm.post_id | |
| WHERE | |
| pm.meta_key = "yoko_directory_email_address" AND | |
| pm.meta_value != "" AND | |
| wp.post_type = "ycd_individual" AND | |
| wp.post_status = "publish" | |
| ) | |
| ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment