wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



rest_sanitize_array › WordPress Function

Od5.5.0
Przestarzałyn/a
rest_sanitize_array ( $maybe_array )
Parametry:
  • (mixed) $maybe_array The value being evaluated.
    Wymagane: Tak
Powrót:
  • (array) Returns the array extracted from the value.
Zdefiniowane na:
Codex:

Converts an array-like value to an array.



Źródło

function rest_sanitize_array( $maybe_array ) {
	if ( is_scalar( $maybe_array ) ) {
		return wp_parse_list( $maybe_array );
	}

	if ( ! is_array( $maybe_array ) ) {
		return array();
	}

	// Normalize to numeric array so nothing unexpected is in the keys.
	return array_values( $maybe_array );
}