0

I have a form that submits the data in array format. I have sanitized all the data and also tried to escape it using esc_attr, but it is a function of escaping and not sanitizing.

Is there a better way to sanitize the entire array (with text value) instead of each individual value.

$array = array_map( 'esc_attr', $array );

How can we make sure the data is sanitize and not just escaped?

1 Answer 1

0

I'm not completely sure what you mean to do, but are you looking for sanitize_text_field?

$array = array_map( 'sanitize_text_field', $array );
1
  • Thanks @cjbj for your reply but this is not i am looking for. I have created a plugin and it is rejected because of using "esc_attr" to sanitize. They mentioned you have to sanitize the array and not just escap the tags.
    – suiz
    May 14, 2020 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.