How to escape wp_send_json?
-
I am writing a plugin and using the WP code sniffer for help.
In an AJAX call the server responds with some JSON:
wp_send_json_success
orwp_send_json_error
In particular I am doing this:
echo wp_send_json_error( $email_confirmation->getData() );
But the code sniffer is unhappy with this and says I should escape the output.
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found ‘wp_send_json_success’.
How?
Is there a function for escaping json?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to escape wp_send_json?’ is closed to new replies.