-
-
Save mashakos/dc0c196ab3a02a69c1000ae6d8ed5e50 to your computer and use it in GitHub Desktop.
Select Wordpress posts by category ID
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 | |
LEFT JOIN wp_term_relationships ON | |
(wp_posts.ID = wp_term_relationships.object_id) | |
LEFT JOIN wp_term_taxonomy ON | |
(wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) | |
WHERE wp_posts.post_type = 'post' | |
AND wp_term_taxonomy.taxonomy = 'category' | |
AND wp_term_taxonomy.term_id = 48 | |
ORDER BY post_date DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment