How do I escape a ‘]’ in a short code?

I don’t know of an official escape syntax for shortcodes and there likely isn’t one.

When wordpress parses for shortcodes it looks for [ and ]. If you want to use square brackets within a shortcode, using the respective html ASCII entities escapes them.

I.e. replacing [ by [ and ] by ]. WordPress will not recognize ] as the end of the shortcode.

Whether that serves your purpose obviously depends on whether it gets converted to ] before being passed to the Google Maps API or whether the API handles it as expected. I have no experience with that, so can’t say.

Leave a Comment