Make WordPress Core

Opened 8 years ago

Closed 6 years ago

#12419 closed enhancement (wontfix)

Add intersect & union support in get_(term|tag|category)_link()

Reported by: scribu Owned by: scribu
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: needs-patch
Focuses: Cc:


Taxonomy Intersections and Unions support has been around since WP 2.3, but the get_term_link() functions only work with a single term.


get_tag_link(array('foo', 'bar'), 'or')  

--> http://example.com/tag/foo,bar
get_tag_link(array('foo', 'bar'), 'and')  

--> http://example.com/tag/foo+bar

Change History (6)

#1 @scribu
8 years ago

The first example should probably be:

get_tag_link(array('foo', 'bar'), 'in')

#2 @dd32
8 years ago

  • Keywords needs-patch added

#3 @filosofo
8 years ago

  • Owner changed from filosofo to scribu
  • Status changed from new to assigned

This probably deserves its own function. Function overloading makes things confusing and harder to support in my opinion.

Also, the arbitrary combination of taxonomy items seems more like a search query than a link to a particular object's "canonical" URI, which is what the other get_* functions do. In my opinion.

#4 @kevinB
8 years ago

  • Cc kevinB added

#5 @nacin
8 years ago

  • Milestone changed from Awaiting Triage to Future Release

#6 @scribu
6 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from assigned to closed

I agree with filosofo that this would be better as a separate function.

But, since there is no permalink support for such queries, one can just use add_query_arg() to construct a URL.

Note: See TracTickets for help on using tickets.