wpseek.com
A WordPress-centric search engine for devs and theme authors



add_magic_quotes › WordPress Function

Since0.71
Deprecatedn/a
add_magic_quotes ( $input_array )
Parameters:
  • (array) $input_array Array to walk while sanitizing contents.
    Required: Yes
Returns:
  • (array) Sanitized $input_array.
Defined at:
Codex:
Change Log:
  • 5.5.0

Walks the array while sanitizing the contents.



Source

function add_magic_quotes( $input_array ) {
	foreach ( (array) $input_array as $k => $v ) {
		if ( is_array( $v ) ) {
			$input_array[ $k ] = add_magic_quotes( $v );
		} elseif ( is_string( $v ) ) {
			$input_array[ $k ] = addslashes( $v );
		} else {
			continue;
		}
	}

	return $input_array;
}