[wp-trac] [WordPress Trac] #34413: calling register_taxonomy() multiple times will overwrite existing object types

WordPress Trac noreply at wordpress.org
Fri Oct 23 14:27:00 UTC 2015


#34413: calling register_taxonomy() multiple times will overwrite existing object
types
--------------------------+---------------------------
 Reporter:  BjornW        |       Owner:  drewapicture
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  4.4
Component:  Taxonomy      |     Version:  2.6
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  docs
--------------------------+---------------------------

Comment (by SergeyBiryukov):

 I think the current docs are somewhat accurate, overwriting a previously
 registered taxonomy counts as modifying.

 > Using register_taxonomy() with the same taxonomy, but different object
 types will result in the already registered object types to be
 overwritten.

 Looks like `register_post_type()` uses
 `register_taxonomy_for_object_type()` and does not have the same issue
 when being subsequently called with different taxonomies.

 We could use the same approach in `register_taxonomy()` too, see
 [attachment:34413.2.diff]. Unit tests would be great.

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


More information about the wp-trac mailing list