[wp-trac] [WordPress Trac] #26475: Hierarchical meta box display issues when messing around with new terms

WordPress Trac noreply at wordpress.org
Tue Mar 17 00:00:11 UTC 2015


#26475: Hierarchical meta box display issues when messing around with new terms
--------------------------+-----------------------------
 Reporter:  ericlewis     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Taxonomy      |     Version:  3.8
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+-----------------------------

Comment (by tyxla):

 I just encountered this issue on a site I was working on, it appears it
 still keeps occuring. Really weird behavior indeed.

 After investigating in-depth, I discovered that this is actually related
 with the `checked_ontop` argument of `wp_terms_checklist()`, which is used
 for the category selection box in the Edit Post screen.

 The problem is that when the `checked_ontop` argument is enabled (which is
 true by default), the checked categories are pushed to the top without
 considering any unselected categories from the hierarchy, which visually
 breaks the related category hierarchy.

 In order to fix this issue, the following should be done when
 `checked_ontop` is `true`:

 1. We should get the ancestor (or the parent from level 0) of each
 selected category.
 2. The found ancestor should be added to the list of checked categories.
 Note: this should not make the ancestor itself "checked" (unless it
 already is), it should only add it to the top of the list, together with
 the other selected categories.
 3. We should get and add the entire hierarchy of the ancestor to the top
 of the list as well, preserving the category hierarchy in the process.
 4. We should unset the categories that we've added to the top from the
 list of categories at the bottom to avoid duplication.

 Patch coming up in a minute.

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


More information about the wp-trac mailing list