WordPress.org

Make WordPress Core

#25567 closed defect (bug) (duplicate)

Nav menus strip out square brackets in url's

Reported by: frisco Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.6.1
Component: Menus Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Similar to trac ticket #24663 or trac ticket #16859, nav menus strip out square brackets in URL's, starting with line 390 of wp-includes/nav-menu.php, because of esc_raw_url(). Behavior exists in trunk as well as 3.6.1.

Square brackets in URL's are needed for query parameters with Elastic Search, and it's helpful to put these pre-built queries into menus. There are probably other use cases as well. The brackets can be encoded, which works fine, but should average users be expected to encode menu URL's?

Is there another way to safely use URL's without stripping square brackets?

Change History (2)

comment:1 @SergeyBiryukov20 months ago

  • Description modified (diff)

comment:2 @ocean9015 months ago

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

Hello frisco,

you're right, square brackets are stripped out. The issue exists in esc_url() and therefore we have the ticket #16859. So let's focus the discussion on this ticket. (I just tested the latest patch on #16859 and can confirm, that it fixes your mentioned issue.)

Note: See TracTickets for help on using tickets.