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 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.5.2 |
Component: | Query | Keywords: | |
Focuses: | Cc: |
Description
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.
http://core.trac.wordpress.org/browser/tags/3.5.2/wp-includes/query.php#L2212
Change History (7)
#3
follow-up:
↓ 4
@
11 years ago
#4
in reply to:
↑ 3
@
11 years ago
Replying to leewillis77:
.. fixes #16793 but actually seems seems completely unrelated to that ticket.
Yes. The ticket is #16703.
#6
@
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()
I managed to get around this using the code here:
http://wordpress.org/support/topic/tax_query-not-working-anything-change-in-latest-version?replies=3#post-4447149