[wp-trac] [WordPress Trac] #28033: post_categories_meta_box on non-hierarchical custom taxonomy

WordPress Trac noreply at wordpress.org
Wed Apr 15 17:24:37 UTC 2015

#28033: post_categories_meta_box on non-hierarchical custom taxonomy
 Reporter:  ByronicEntity               |       Owner:  rufein
     Type:  defect (bug)                |      Status:  assigned
 Priority:  normal                      |   Milestone:  Future Release
Component:  Taxonomy                    |     Version:  3.9
 Severity:  normal                      |  Resolution:
 Keywords:  good-first-bug needs-patch  |     Focuses:  ui, administration

Comment (by unknowndomain):

 This is a really poor solution, blocking the developer from doing
 something because WordPress is a bit rough round the edges isn't the
 correct solution.

 There seems to be a number of people who want to use the checkbox
 (category) style UI on non-hierarchical taxonomies. I don't see why there
 are two different ajax handlers, and ways of displaying taxonomies which
 are essentially in the back end identical...

 In my view the correct solution would be to make both the category and tag
 meta box's use either IDs or slugs but be consistent and use the same AJAX
 call back. This way the developer above and myself and others who have the
 same issue would be able to switch the call backs out and know it will
 work correctly, and use that AJAX endpoint for their own custom metaboxes.

 Replying to [comment:5 rufein]:
 > I've done my first ticket.
 > The documentacion in `register_taxonomy()` says explicitly:
 >   meta_box_cb - Provide a callback function for the meta box display.
 >   If not set, defaults to post_categories_meta_box for hierarchical
 >   and post_tags_meta_box for non-hierarchical.
 > The author of this ticket is setting manually the wrong function to
 manage non-hierarchical terms.
 > I've reproduced the error and when an user create throungh Ajax a new
 term, the upper function creates the output reported in this thread. When
 the Ajax call is executed in server, it creates a new term that stores in
 database. At the end of the proccess, it creates options to be added to
 the form, but the function duplicate it because it also attach a parent
 option that not exist. So, finally, ajax add an non-existing term to the
 form. If you submit a non-existing term in the form, it will be created.
 If not, it will disappear.
 > I've created a patch to avoid that function `post_categories_meta_box()`
 being assigned to a non-hierarchical taxonomies.

Ticket URL: <https://core.trac.wordpress.org/ticket/28033#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list