Opened 14 years ago
Closed 14 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: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Menus | Version: | 3.3.2 |
| Severity: | trivial | Keywords: | has-patch |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Having an empty class attribute doesn't really cause any problems; it's valid HTML.