How do I sanitize a javascript text?

I have a textarea that will receive a js snippet(Google Analytics). Is there a way to sanitize that? Since I cannot use functions like wp_filter_nohtml_kse(), what should I use?

3 Answers
3

No, there is no function for that. You would need a complete JavaScript parser. This is not part of the WordPress core.

Leave a Comment