add_magic_quotes( array $input_array ): array

Walks the array while sanitizing the contents.


Parameters

$input_array array Required
Array to walk while sanitizing contents.

Top ↑

Return

array Sanitized $input_array.


Top ↑

Source

File: wp-includes/functions.php. View all references

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;
}


Top ↑

Changelog

Changelog
Version Description
5.5.0 Non-string values are left untouched.
0.71 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.