Taxonomy Intersections and Unions

WordPress 2.3 has built-in support for some common and useful tag and category queries. A public query variable named “tag” allows retrieving all posts associated with one or more tags. Here are some examples.

There are also a number of private query variables that plugins can use to perform union and intersection queries for categories and tags. Plugins can insert these queries into the global query by hooking onto the ‘parse_request’ action and calling $wp->set_query_var() from their handler.

  • category__in – Accepts an array of category IDs. Fetches posts in any one of the specified categories.
  • category__not_in – Accepts an array of category IDs. Fetches posts that are not in any of the specified categories.
  • category__and – Accepts an array of category IDs. Fetches posts that are in all of the specified categories.
  • tag__in – Accepts an array of tag IDs. Fetches posts having any one of the specified tags.
  • tag__not_in – Accepts an array of tag IDs. Fetches posts that do not have any of the specified tags.
  • tag__and – Accepts an array of tag IDs. Fetches posts that have all of the specified tags.
  • tag_slug__in – Accepts an array of tag slugs. Fetches posts having any one of the specified tags.
  • tag_slug__and – Accepts an array of tag slugs. Fetches posts that have all of the specified tags.

WordPress 2.3 Delivered, 2.4 on Deck

WordPress 2.3 arrived a couple days ago. Reception has been very positive, and most people seem pleased with it.  As expected, plugin compatibility due to the schema changes caused some grief. Two very popular plugins that need to be upgraded when moving to 2.3 are Google Sitemaps and Extended Live Archives. If you have one of those plugins, please be sure to upgrade to the latest version.

This being a major release with lots of changes, some little bugs have popped up. We’re fixing them as they come in and targeting them for an eventual 2.3.1 release. A release date for 2.3.1 has not yet been set, but we typically follow a major release with a “dot one” bug fix release within a month or so. You can watch the activity on the 2.3.1 milestone to see what bugs are being reported and fixed. If you have any problems with 2.3, please report them so we can get them fixed.

With 2.3 done, we’ve started work on 2.4. This is the exciting phase of development where we get to work on new features, and 2.4 promises to have lots of new features. Whereas 2.3 had more of an infrastructure focus, 2.4 looks like it will focus on UI and user experience. I’m excited about the features being pitched for 2.4. There’ll be more on that as the feature list is finalized and the designs and code start to flow. For now I’ll leave you with the tease of cool things to come.