Opened 12 years ago
Closed 12 years ago
#20674 closed enhancement (duplicate)
if menu classes are empty the empty attribute will be added to the <li> (solution inside)
Reported by: | janw.oostendorp | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | trivial | Version: | 3.3.2 |
Component: | Menus | Keywords: | has-patch |
Focuses: | Cc: |
Description
I often remove the classes form the <li> in menu's with the filter 'nav_menu_css_class'.
That results in empty 'class="" ' attributes in my menu's.
Fixing this is easy to do in the core:
/wp-includes/nav-menu-template.php
line 77
$class_names = ' class="' . esc_attr( $class_names ) . '"';
should be replaced with:
if (!empty($class_names )) { $class_names = ' class="' . esc_attr( $class_names ) . '"'; }
Change History (3)
Note: See
TracTickets for help on using
tickets.
Having an empty class attribute doesn't really cause any problems; it's valid HTML.