[wp-trac] [WordPress Trac] #34839: Wrong attribution of current_page_parent for menus when on single/archive CPT

WordPress Trac noreply at wordpress.org
Tue Oct 11 16:03:21 UTC 2016


#34839: Wrong attribution of current_page_parent for menus when on single/archive
CPT
-------------------------------------+------------------------------
 Reporter:  tabrisrp                 |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Menus                    |     Version:  3.0
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  template
-------------------------------------+------------------------------
Changes (by mdgl):

 * keywords:   => has-patch needs-testing


Comment:

 With regard to the first issue, see #16382 which is marked "wontfix" as it
 seems `current_page_parent` is added as a backwards-compatibility measure.
 New themes/plugins should best rely only on the newer classes (with
 hyphens).

 For the other problems, code to properly set the menu item parent/ancestor
 classes was missing for custom post type archives. In fact, this code
 shouldn't be dependent on object type, so in the forthcoming patch I have
 factored this out into a common block. This also makes function
 `_wp_menu_item_classes_by_context()` slightly easier to read and
 understand (but still pretty opaque!).

 I took the opportunity of incorporating the fix for #32918 at the same
 time (easier now the code is in just one place).

 It's likely a number of other bugs are lurking in this area of code.  We
 could really do with some unit tests: see #32367.

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


More information about the wp-trac mailing list