Title: Missing string escaping
Last modified: August 2, 2021

---

# Missing string escaping

 *  [michalbluma](https://wordpress.org/support/users/michalbluma/)
 * (@michalbluma)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/missing-string-escaping/)
 * Hi.
 * Really loving your plugin so far.
    Alas, I’ve hit a snag: When configuring the
   map, after entering a filter label with a single-quote, the whole filters panel
   stops working.
 * I’ve tracked it down to the JS you inject for variables not having any escaping.
   
   In /admin/partials/locate-and-filter-metabox-admin.php on line 477, when you’re
   echoing your `display_filters` var, there is zero escaping being done.
 * So, for instance, if you enter “Some single-quote’s label”, you end up with `'
   Some single-quote's label'` . As you can imagine, it doesn’t know what to do 
   with “s label”.
 * May I suggest that you create your variable in PHP and then simply json_encode
   the result that you output in your JS? That would prevent any escaping woes.
 * Cheers,
    Michal
    -  This topic was modified 4 years, 8 months ago by [michalbluma](https://wordpress.org/support/users/michalbluma/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fmissing-string-escaping%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

The topic ‘Missing string escaping’ is closed to new replies.

 * ![](https://ps.w.org/locateandfilter/assets/icon-128x128.png?rev=2050267)
 * [LocateAndFilter](https://wordpress.org/plugins/locateandfilter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/locateandfilter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/locateandfilter/)
 * [Active Topics](https://wordpress.org/support/plugin/locateandfilter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/locateandfilter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/locateandfilter/reviews/)

## Tags

 * [.js errors](https://wordpress.org/support/topic-tag/js-errors/)

 * 0 replies
 * 1 participant
 * Last reply from: [michalbluma](https://wordpress.org/support/users/michalbluma/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/missing-string-escaping/)
 * Status: not resolved