rest_sanitize_array( mixed $maybe_array ): array

In this article

Converts an array-like value to an array.

Parameters

$maybe_arraymixedrequired
The value being evaluated.

Return

array Returns the array extracted from the value.

Source

 * Converts an array-like value to an array.
 *
 * @since 5.5.0
 *
 * @param mixed $maybe_array The value being evaluated.
 * @return array Returns the array extracted from the value.
 */
function rest_sanitize_array( $maybe_array ) {
	if ( is_scalar( $maybe_array ) ) {
		return wp_parse_list( $maybe_array );
	}

Changelog

VersionDescription
5.5.0Introduced.

User Contributed Notes

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