[wp-trac] [WordPress Trac] #35848: WordPress 4.4 Handling Custom Taxonomies and Tax Queries Correctly

WordPress Trac noreply at wordpress.org
Wed Feb 17 05:53:22 UTC 2016

#35848: WordPress 4.4 Handling Custom Taxonomies and Tax Queries Correctly
 Reporter:  vrazer        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  4.4
 Severity:  normal        |   Keywords:
  Focuses:                |
 As of the WordPress 4.4 release, we have seen several sites that are using
 custom post types and custom taxonomies that no longer respond correctly
 to taxonomy page requests.


 Custom Post Type 1
 -- Custom Tax 1 (slug = customtax1)
 -- Custom Tax 2 (slug = customtax2)

 Custom Post Type 2
 -- Custom Tax 3 (slug = customtax3)
 -- Custom Tax 4 (slug = customtax4)

 A query like this ?customtax1=term1&customtax3=term2&customtax2=term4
 should result in a taxonomy query where you get posts/post types that have
 the respective term values associated with the post object for each of
 those taxonomies.  Instead as of WordPress 4.4, these queries are
 returning the home page of the site with is_home = true (not a taxonomy
 template) and completely disregarding the taxonomy query.

 Important notes:
 1) Custom Post Type/Taxonomy plugins have been observed on these sites.
 It is not limited to any specific custom post type/taxonomy plugin
 2) register_post_type and register_taxonomy ARE being called by these
 plugins via the init hook
 3) Reverting to 4.3.x fixes the issue
 4) Custom taxonomies in the admin and custom post types everywhere still
 seem to be working the same as with previous WP versions.  The issue seems
 to be related only to the main query of front end requests.
 5) Switching themes does not fix the issue
 6) Migrating the register_post_type and register_taxonomy definitions to
 functions.php in the main theme and verifying they are run in an init hook
 does not fix the issue.
 7) Trying to work around the issue by running pre_get_posts and applying
 the appropriate tax_query to the main query does not fix the issue.
 8) Setting the post_type to the associated custom post type for the custom
 taxonomy in a "request" hook or "pre_get_posts" hook does not fix the
 issue, but it does shift the theme template to the custom post type's
 archive template (which at least rectifies the visual display problem
 associated with the incorrect query parsing, but it still doesn't
 appropriately filter the request)
 9) Creating a WP_Tax_Query manually does return the desired tax_query, but
 this does not appear to work with $query->set in pre_get_posts either by
 assigning the tax_query as an array or WP_Tax_Query object (which was a
 hail mary test)

 Any necessary information needed to debug this can be provided.  But it
 "appears" to be some sort of regression or new bug associated with the new
 taxonomy features and that is limited to custom post types with custom

Ticket URL: <https://core.trac.wordpress.org/ticket/35848>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list