Skip to content

Instantly share code, notes, and snippets.

@brianium
Created June 2, 2012 19:59
Show Gist options
  • Save brianium/2859761 to your computer and use it in GitHub Desktop.
Save brianium/2859761 to your computer and use it in GitHub Desktop.
sermon query for custom wordpress
SELECT DISTINCT p.ID
FROM wp_posts p
LEFT JOIN wp_term_relationships tr ON tr.object_id = p.ID
LEFT JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_id
LEFT JOIN wp_terms t ON tt.term_id = t.term_id
WHERE p.post_type = "sermon"
AND p.post_status = "publish"
ORDER BY p.ID ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment