(Updated, see below) WordPress 3.1 introduced some awesome new taxonomy query features, and the URL parsing allows some rudimentary syntax to query multiple terms and choose if the query is OR’d or AND’d.
The URL syntax is as follows:
- A comma (,) between terms will return posts containing either term (logical OR), like this http://maisonbisson.com/post/tag/wordpress,mysql/ .
- A plus sign (+) between terms will return posts containing all terms (logical AND), like this http://maisonbisson.com/post/tag/wordpress+mysql/ .
Sadly, there’s no native way to structure a URL that excludes certain terms, and I’m not really comfortable mixing term separators and logical operators.
Suggestion: Separate all terms with commas (or spaces, represented in the URL as %20), and optionally prepend each term with an operator.
Example: The following query would require both “wordpress” and “mysql” tags, but exclude posts that have the “nginx” tag, http://maisonbisson.com/post/tag/+wordpress,+mysql,-nginx/ .
This syntax is similar to that many people are already familiar with when querying search engines (especially in Google, until recently). It could also probably be implemented in a way that’s backwards compatible with the current syntax.
Worth a core patch? I’m on it if anybody else thinks this is a worthwhile feature.
Update: Ticketed with patch in WordPress core trac, and the patch is live on this site now.
Update 2: The new version of Scriblio doesn’t yet support these new logical operators, but I’d love to integrate support if a feature like this is implemented in core WordPress.