Opened 10 years ago
Closed 10 years ago
#32590 closed defect (bug) (fixed)
Malformed `object_types` when using `register_taxonomy_for_object_type()` on taxonomy that doesn't already have object types
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.3 | Priority: | low |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | |
Focuses: | Cc: |
Description
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
Change History (1)
Note: See
TracTickets for help on using
tickets.
In 32709: