#17409 closed defect (bug) (invalid)
Entity & in menu title breaks XHTML 1.0 Strict validation
| Reported by: | Florat | Owned by: | Florian |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Menus | Version: | 3.1.2 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
If i use & in the menu title and use $my_menu = wp_get_nav_menu_items("my_menu") and loop with foreach($my_menu as $menu_item) and connect for building the Menu on $menu_item->title, then an & in the page title or on the menu navigation label is convertet to a simple &, witch returns the validation error "xmlParseEntityRef: no name".
Change History (4)
This ticket was mentioned in IRC in #wordpress-dev by Steve_p. View the logs.
12 years ago
#4
in reply to: ↑ 3
@
12 years ago
- Keywords close removed
- Milestone Awaiting Review
Replying to Steve_p:
When using $menu_item->menu_title directly, you need to use esc_html() to encode HTML entities correctly.
Or, as wp_nav_menu() and his Walker, do apply_filters( 'the_title', $menu_item->menu_title, $menu_item->ID ).
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Thanks for the report and sorry for taking so long to get back to you. This does not seem to be a bug. When using $menu_item->menu_title directly, you need to use esc_html() to encode HTML entities correctly.