Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#24819 closed defect (bug) (wontfix)

tax_query not executed on single post/page/etc

Reported by: maxaud's profile maxaud Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5.2
Component: Query Keywords:
Focuses: Cc:


in /wp-includes/query.php on line 2212 there is an if statement that blocks a tax_query filter from executing if is_single is true.

In my particular use case, I need to use tax_query on single pages and posts and am surprised this is being blocked..

My particular WordPress stops certain pages from displaying under certain circumstances dependent upon what term they belong to in a custom taxonomy. I see this ability becoming ever more common the more people use WordPress to create web apps and CMS platforms.

Change History (7)

#1 @maxaud
11 years ago

  • Cc dustin@… added

#3 follow-up: @leewillis77
11 years ago

This was added in [17504]. The commit message claims it fixes #16793 but actually seems completely unrelated to that ticket. So, probably not as straightforward as just removing the condition.

Last edited 11 years ago by ocean90 (previous) (diff)

#4 in reply to: ↑ 3 @ocean90
11 years ago

Replying to leewillis77:

.. fixes #16793 but actually seems seems completely unrelated to that ticket.

Yes. The ticket is #16703.

#5 @SergeyBiryukov
11 years ago

Looking at #16703, this sounds like a wontfix to me.

#6 @maxaud
11 years ago

Instead of removing the if statement, what about checking to see if a tax_query is set?

I managed to get around it by duplicating the code to my own class and filtering the where and join clauses but obviously I expected my tax_query to work on singular post/page otherwise I would have used is_singular() to check before applying tax_query.

I would imagine changing it now would most likely mess with other people's working code because they most likely don't check for !is_singular()

#7 @wonderboymusic
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Too edge case for such an impactful change to query

Note: See TracTickets for help on using tickets.