WordPress.org

Make WordPress Core

Opened 18 months ago

Last modified 18 months ago

#19705 new enhancement

better taxonomy query URL syntax

Reported by: misterbisson Owned by:
Priority: normal Milestone: Awaiting Review
Component: Query Version: 3.3
Severity: normal Keywords: has-patch
Cc:

Description

Problem: WP's native taxonomy URL syntax supports logical OR/IN and AND operations, but not NOT IN. Blog post with more rambling: http://maisonbisson.com/blog/post/16074/better-taxonomy-query-syntax/ .

Solution: the attached patch extends the URL syntax to support these logical operators.

  • Taxonomy terms are separated by commas (it preserves support for the old +separated syntax).
  • Terms prepended with a + are required (AND)
  • Terms prepended with a - are excluded (NOT IN)
  • All other terms are simply IN

Examples:

Working examples (at least until I revert my site):

About the patch:

The patch disables the special handling of tags. This is just to narrow the scope of work necessary to demonstrate a working patch.

Attachments (1)

better-tax-syntax.diff (2.6 KB) - added by misterbisson 18 months ago.

Download all attachments as: .zip

Change History (2)

comment:1 vhauri18 months ago

+1 for this patch and the functionality it adds.

Note: See TracTickets for help on using tickets.