[wp-trac] [WordPress Trac] #35089: Query var on non-public taxonomy remains boolean true since [35333]

WordPress Trac noreply at wordpress.org
Tue Dec 15 21:47:24 UTC 2015


#35089: Query var on non-public taxonomy remains boolean true since [35333]
-----------------------------------+--------------------
 Reporter:  johnbillion            |       Owner:
     Type:  defect (bug)           |      Status:  new
 Priority:  normal                 |   Milestone:  4.4.1
Component:  Taxonomy               |     Version:  4.4
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+--------------------
Changes (by boonebgorges):

 * keywords:  needs-patch needs-unit-tests => has-patch 2nd-opinion


Comment:

 Thanks for the ticket, @johnbillion.

 It was decided in [35333] that the best way to prevent non-public
 taxonomies from being queryable on the front-end was to prevent them from
 registering a query_var. This is similar to the strategy that's used for
 non-public post types.

 IMO it's a little bit weird to combine `query_var = true` with `public =
 false`. That being said, this does look like a legitimate bug.

 The root problem, as I see it, is that `wp_list_filter()` (via
 `wp_filter_object_list()`) uses non-strict comparison `==`, so that `true
 == 'bar'`. https://core.trac.wordpress.org/browser/tags/4.4/src/wp-
 includes/functions.php?marks=3332#L3302 I understand why we can't switch
 to strict comparison here, but I wonder how much stuff would break if
 `wp_list_filter()` explicitly avoided comparing booleans and non-empty
 strings - it's hard to imagine a legitimate use for this.

 It's probably unlikely that we can change the behavior of
 `wp_list_filter()` or even `get_taxonomies()` here. So maybe a more local
 fix is that, in `register_taxonomy()`, non-public taxonomies have
 `query_var` forced to `false`. It's not very attractive, but it should
 minimize fallout. See [attachment:35089.diff].

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35089#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list