How to select posts with specific tags, categories in WordPress | SQL
How to select posts with specific tags/categories in WordPress This is a very specific question regarding MySQL as implemented in WordPress . I'm trying to develop a plugin that will show (select) posts that have specific 'tags' and belong to specific 'categories' (both multiple) I was told it's impossible because of the way categories and tags are stored: wp_posts contains a list of posts, each post have an "ID" wp_terms contains a list of terms (both categories and tags). Each term has a TERM_ID wp_term_taxonomy has a list of terms with their TERM_IDs and has a Taxonomy definition for each one of those (either a Category or a Tag) wp_term_relationships has associations between terms and posts How can I join the tables to get all posts with tags "Nuclear" and "Deals" that also belong to the category "Category1"? 6 Answers I misunderstood you. I thought you wanted Nuclear or Deals. The below should giv...