Allow wc_clean to support arrays

Closes #9329 @claudiosmweb
This commit is contained in:
Mike Jolley 2015-10-09 10:41:48 +01:00
parent 090de0c6a7
commit 4399a3b48a
1 changed files with 4 additions and 5 deletions

View File

@ -244,13 +244,12 @@ function wc_format_localized_decimal( $value ) {
}
/**
* Clean variables
*
* @param string $var
* @return string
* Clean variables using sanitize_text_field
* @param string|array $var
* @return string|array
*/
function wc_clean( $var ) {
return sanitize_text_field( $var );
return is_array( $var ) ? array_map( 'wc_clean', $var ) : sanitize_text_field( $var );
}
/**