Skip to content

Instantly share code, notes, and snippets.

@duythien
Created August 25, 2014 10:19
Show Gist options
  • Select an option

  • Save duythien/62a2e810f5a88cec6efb to your computer and use it in GitHub Desktop.

Select an option

Save duythien/62a2e810f5a88cec6efb to your computer and use it in GitHub Desktop.
wp
SELECT t.*, tt.*, tr.object_id, p.*
FROM wp_terms AS t
INNER JOIN wp_posts AS p
ON p.id = t.term_id
INNER JOIN wp_term_taxonomy AS tt
ON tt.term_id = t.term_id
INNER JOIN wp_term_relationships AS tr
ON tr.term_taxonomy_id = tt.term_taxonomy_id
WHERE tt.taxonomy IN ('category', 'post_tag', 'post_format')
AND tr.object_id IN (8)
ORDER BY t.name ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment