Make WordPress Core

Opened 8 years ago

Last modified 4 years ago

#38486 assigned defect (bug)

current_page_parent class wrongly added to menu item

Reported by: henrywright's profile henry.wright Owned by: williampatton's profile williampatton
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.6.1
Component: Menus Keywords: has-patch needs-unit-tests needs-testing
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 8 years ago.
38486.2.diff (1.6 KB) - added by florianbrinkmann 7 years ago.

Download all attachments as: .zip

Change History (10)

#1 @welcher
8 years ago

  • Keywords needs-patch added

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

#2 @christophherr
8 years ago

Related history #13543 (especially comments 10 & 13]

8 years ago

#3 @henry.wright
8 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
7 years 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 7 years ago by FlorianBrinkmann (previous) (diff)

#5 @leec87
5 years ago

#46787 was marked as a duplicate.

#6 @leec87
5 years ago

When will this be added into core? the issue is still a big problem, in 5.1.1, I'm right now trying to work a fix via CSS, but it's just not working well (I have two highlighted menu items, the CPT archive menu item, and the Blog item).

#7 @williampatton
5 years ago

  • Keywords needs-unit-tests needs-testing added
  • Owner set to williampatton
  • Status changed from new to assigned

I'll pick this one up and try shepherd it through testing and onto a Future Release milestone.

#8 @jameelmoses
4 years ago

Any progress on this? Still an issue in 5.4.2.

Note: See TracTickets for help on using tickets.