wc_clean() – Clean variables using sanitize_text_field. Arrays are cleaned recursively.

You appear to be a bot. Output may be restricted

Description

Clean variables using sanitize_text_field. Arrays are cleaned recursively.

Non-scalar values are ignored.

Usage

$string|array = wc_clean( $var );

Parameters

$var
( string|array ) required – Data to sanitize.

Returns

string|array

Source

File name: woocommerce/includes/wc-formatting-functions.php
Lines:

1 to 7 of 7
function wc_clean( $var ) {
  if ( is_array( $var ) ) {
    return array_map( 'wc_clean', $var );
  } else {
    return is_scalar( $var ) ? sanitize_text_field( $var ) : $var;
  }
}
 

 View on GitHub View on Trac