WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#4895 closed defect (bug) (fixed)

Tag unions and intersections

Reported by: ryan Owned by:
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.3
Component: General Keywords: taxonomy, tags
Focuses: Cc:

Description (last modified by ryan)

As was done for categories in #4750, let's add private tag__in, tag__and, and tag__not_in query vars.

Let's also decide on how to specify intersections and unions in the public query vars. We have tag_id and tag. tag_id currently takes a single numeric ID, and tag takes a single tag slug. tag is the var we use when creating links and such. tag_id isn't exposed anywhere at the moment. I think we can extend tag to allow the use of "+" to request tag intersections and commas to request unions. Only one or the other can be specified in the same request.

tag+tag2+tag3

tag,tag2,tag3

Attachments (1)

tag_intersect_union.diff (5.3 KB) - added by ryan 7 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 ryan7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [6011]) tagin, tagnot_in, and tag_and queries. fixes #4895

comment:2 ryan7 years ago

(In [6012]) tag_id not tagid. see #4895

comment:3 ryan7 years ago

  • Summary changed from Category unions and intersections to Tag unions and intersections

comment:4 ryan7 years ago

  • Description modified (diff)
  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:5 ryan7 years ago

  • Description modified (diff)

comment:6 ryan7 years ago

  • Description modified (diff)

ryan7 years ago

comment:7 ryan7 years ago

Patch parses "tag" queries that can plus and comma. Intersections are parsed into tag_slug__and and unions are parsed into tag_slug__in. The joins are rather hairy. Don't know if it would be best to get the IDs for the slugs in a separate query to spare the extra join.

comment:8 markjaquith7 years ago

Regarding tag_id, I don't think we should ever expose that because I don't think we should ever rely on that ID being static.

comment:9 ryan7 years ago

It's kinda there mainly for plugins that already have an ID. We could keep it and make it private.

comment:10 ryan7 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [6021]) Tag unions and intersections. fixes #4895

Note: See TracTickets for help on using tickets.