• I need to set up numerous Custom Links in a menu. The URLs have square brackets in them.

    Upon saving the menu, WordPress is encoding the square brackets into ASCII codes. I’d rather it didn’t, as it’s not necessary as far as WordPress recognising the URLs is concerned, and it makes the URLs harder to decipher.

    An example URL would be: my-domain.com.au/?filter=taxonomy[1-443]&taxonomy2=[27]

    This gets converted to: my-domain.com.au/?filter=taxonomy%5B1-443%5D&taxonomy2=%5B27%5D

    Is there any way to prevent this from occurring?
    Also, perhaps more importantly, is there any issue that might arise by preventing it — are the valid reasons not to prevent them encoding?

    Thank you.

    • This topic was modified 3 years, 8 months ago by inspired888.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Any URL content between = and the next & needs to be URL encoded like this. Failure to do so introduces significant security vulnerability (script injection attacks specifically). Presentation of URLs on a page can be URL decoded, but then must also be escaped for similar reasons. Escaping shouldn’t affect appearance.

Viewing 1 replies (of 1 total)
  • The topic ‘Prevent square brackets in Custom Links menu item converting to ASCII code?’ is closed to new replies.