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_postscontains a list of posts, each post have an "ID"wp_termscontains a list of terms (both categories and tags). Each term has a TERM_IDwp_term_taxonomyhas 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_relationshipshas 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"?
I misunderstood you. I thought you wanted Nuclear or Deals. The below should give you only Nuclear and Deals.