• Adam

    (@goodfreegames)


    I have a URL that I need to put in my custom menu, but it contains square brackets [].
    Something like…
    ‘mypage/?action=search&class[]=1&class[]=2&class[]=3’

    When I do this, WP strips the brackets. I’m guessing it’s because shortcode uses these.

    I’ve also tried using the ascii equivalent, which works the first time, but after updating, it displays the brackets, so any subsequent changes to the menu will remove the brackets.. unless I use ascii every time any menu item needs changing.

    Is there a way to do this? Do I need to add a filter?

    Thanks ??

Viewing 1 replies (of 1 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    As found in RFC 1738 documentation

    “Many URL schemes reserve certain characters for a special meaning:
    their appearance in the scheme-specific part of the URL has a
    designated semantics. If the character corresponding to an octet is
    reserved in a scheme, the octet must be encoded. The characters “;”,
    “/”, “?”, “:”, “@”, “=” and “&” are the characters which may be
    reserved for special meaning within a scheme. No other characters may
    be reserved within a scheme.

    Thus, only alphanumerics, the special characters “$-_.+!*'(),”, and
    reserved characters used for their reserved purposes may be used
    unencoded within a URL.”

    Look at serialize() and unserialize() for passing array and object data via POST or GET

Viewing 1 replies (of 1 total)
  • The topic ‘Square brackets in URL (Custom Menus)’ is closed to new replies.