[wp-trac] [WordPress Trac] #32590: Malformed `object_types` when using `register_taxonomy_for_object_type()` on taxonomy that doesn't already have object types

WordPress Trac noreply at wordpress.org
Mon Jun 8 19:34:55 UTC 2015


#32590: Malformed `object_types` when using `register_taxonomy_for_object_type()`
on taxonomy that doesn't already have object types
--------------------------+-----------------
 Reporter:  boonebgorges  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  low           |  Milestone:  4.3
Component:  Taxonomy      |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------
 If you register a taxonomy with an empty `$object_type`, eg

 {{{
 register_taxonomy( 'foo', '' );
 }}}

 and later on decide to register the taxonomy with a post type:

 {{{
 register_taxonomy_for_object_type( 'foo', 'post' );
 }}}

 the 'object_types' property of the taxonomy object will be an array of the
 form:

 {{{
 array(
     '',
     'post',
 )
 }}}

 This can cause various sorts of weirdness. The issue I ran into is that
 the 'update_count_callback' fallback ends up being
 `_update_generic_term_count()` instead of the correct
 `_update_post_term_count()`, because of the `array_filter()` check here:
 https://core.trac.wordpress.org/browser/tags/4.2.2/src/wp-
 includes/taxonomy.php?marks=3670-3676#L3657

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


More information about the wp-trac mailing list