[wp-trac] [WordPress Trac] #21949: Allow private taxonomies (public = false)

WordPress Trac noreply at wordpress.org
Thu Oct 1 16:43:04 UTC 2015


#21949: Allow private taxonomies (public = false)
--------------------------------+---------------------------
 Reporter:  wpsmith             |       Owner:  boonebgorges
     Type:  enhancement         |      Status:  reopened
 Priority:  normal              |   Milestone:  4.4
Component:  Taxonomy            |     Version:
 Severity:  normal              |  Resolution:
 Keywords:  has-patch rest-api  |     Focuses:
--------------------------------+---------------------------
Changes (by mboynes):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 We may want to re-think this implementation; this commit broke a section
 of a site I built.

 I had a semi-public taxonomy where the taxonomy terms were used in url
 structures for posts, but not accessed directly. I set  `public => false`
 in this taxonomy because I didn't want the terms ever being queried
 directly. For the purposes of my rewrites, I added a rewrite tag with the
 same name as the taxonomy (so it was clear that there was a relationship
 between the rewrite tag and the taxonomy). This update unsets the query
 var that my rewrite tag added because the rewrite tag and the taxonomy
 shared the same name.

 My usage here may be fairly exceptional, but I'm a little concerned that
 there are situations where a private taxonomy inadvertently shares a name
 with a query var, and this update will now unset that query var.

 Looking over the fix, is there any reason why we're letting
 `register_taxonomy()` add the query var, and then later unsetting it? Why
 not simply prevent `register_taxonomy()` from adding it? We could
 replace...

 {{{
 if ( false !== $args['query_var'] && ! empty( $wp ) ) { ... }
 }}}

 ... with...

 {{{
 if ( false !== $args['query_var'] && false !== $args['public'] && ! empty(
 $wp ) ) { ... }`
 }}}

 ... and that should prevent the issue I encountered while simultaneously
 simplifying the fix for this issue. Thoughts?

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


More information about the wp-trac mailing list