Make WordPress Core

Opened 2 years ago

Last modified 18 months ago

#38486 new defect (bug)

current_page_parent class wrongly added to menu item

Reported by: henry.wright Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.6.1
Component: Menus Keywords: has-patch
Focuses: Cc:


If the current page being viewed is either of the following:

  • a custom post type archive
  • a custom post type single item

a current_page_parent class is added to the menu item assigned as the page_for_posts.

I believe this is wrong because the page assigned as the page_for_posts is associated with posts only. It has nothing to do with CPTs.

Attachments (2)

38486.diff (1.2 KB) - added by henry.wright 2 years ago.
38486.2.diff (1.6 KB) - added by florianbrinkmann 18 months ago.

Download all attachments as: .zip

Change History (6)

#1 @welcher
2 years ago

  • Keywords needs-patch added

Thanks for the ticket! Would you like to create a patch?

#2 @christophherr
2 years ago

Related history #13543 (especially comments 10 & 13]

2 years ago

#3 @henry.wright
2 years ago

  • Keywords has-patch added; needs-patch removed

@welcher sure!

Attached is 38486.diff, which will ensure the current_page_parent class doesn't get added to the static home page link if the query is for a custom post type single item or archive.

#4 @FlorianBrinkmann
18 months ago

I have the same issue. The patch from @henry.wright fixes that the current_page_parent class is added incorrectly to the blog page menu item when viewing a CPT archive or single view. My patch 38486.2.diff goes further and adds the current_page_parent class to the post type archive menu item if a single view of this CPT is displayed.

@welcher and/or @westonruter – could you take a look at the patch? Would be great to get a fix for that into core :)

Last edited 18 months ago by FlorianBrinkmann (previous) (diff)
Note: See TracTickets for help on using tickets.