Created
October 5, 2012 08:23
-
-
Save redroot/3838739 to your computer and use it in GitHub Desktop.
Wordpress: Find posts with a specific meta key
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
| # swap out 'videoid' for whichever meta keys you want | |
| SELECT A.ID, B.post_id, A.post_title, A.post_date FROM | |
| (SELECT ID, | |
| post_date, post_title | |
| FROM wp_posts | |
| WHERE post_status = "publish" | |
| ) as A | |
| JOIN | |
| (SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE meta_key = "videoid") as B | |
| ON A.ID = B.post_id | |
| ORDER BY A.post_date |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment