Make WordPress Core

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#15570 closed defect (bug) (wontfix)

wp_nav_menu classes not named consistently

Reported by: iandunn's profile iandunn Owned by:
Milestone: Priority: normal
Severity: minor Version: 3.0.1
Component: Menus Keywords:
Focuses: Cc:

Description

The CSS classes assigned by wp_nav_menu seem to randomly switch between using dashes and underscores to separate words. For example

current_page_item
current-menu-item
menu-item-type-post_type

I can see a justification for making menu-item-type-post_type use an underscore to match the database field, function parameters, etc, but switching between dashes and underscore within the same class name is counter-intuitive. I don't see any reason why current_page_item and current-menu-item wouldn't match.

I think either dashes or underscores should be chosen and used exclusively across all class names.

Change History (3)

#1 @aaroncampbell
13 years ago

current_page_item is legacy and there for backwards compatibility. Dashes are the new standard, so themes should be using the *menu-item* classes now.

#2 @nacin
12 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

I agree that post_type probably should have been post-type, but it's too late now, and we're not going to add a second class as we'd have to keep the old one.

Otherwise, Aaron is correct.

#3 @GaryJ
12 years ago

  • Keywords current_page_item current-menu-item dash underscore class removed

Is there actually any harm in adding a current-page-item class next to current_page_item class, if the underscore version could be some how marked as deprecated?

The longer the inconsistency remains, ultimately the more themes would need to be amended if the switch was made.

Note: See TracTickets for help on using tickets.