Created
December 5, 2009 11:03
-
-
Save zoranzaric/249647 to your computer and use it in GitHub Desktop.
Some usefull SQL-Querys for Wordpress
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
#get all published posts with their tags and categorys | |
SELECT * | |
FROM wp_posts | |
LEFT JOIN wp_term_relationships | |
ON wp_posts.ID=wp_term_relationships.object_id | |
LEFT JOIN wp_terms | |
ON wp_term_relationships.term_taxonomy_id=wp_terms.term_id | |
WHERE post_status='publish'; | |
#get all published posts for a given tag-id or category-id | |
SELECT * | |
FROM wp_posts | |
LEFT JOIN wp_term_relationships | |
ON wp_posts.ID=wp_term_relationships.object_id | |
WHERE post_status='publish' | |
AND wp_term_relationships.term_taxonomy_id=1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment