wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi
rest_stabilize_value › WordPress Function
Da5.5.0
Deprecaton/a
› rest_stabilize_value ( $value )
| Parametri: |
|
| Ritorna: |
|
| Definito a: |
|
| Codex: |
Stabilizes a value following JSON Schema semantics.
For lists, order is preserved. For objects, properties are reordered alphabetically.Funzioni correlate: rest_sanitize_boolean, rest_sanitize_array, rest_sanitize_value_from_schema, rest_sanitize_object, rest_are_values_equal
Sorgenti
function rest_stabilize_value( $value ) {
if ( is_scalar( $value ) || is_null( $value ) ) {
return $value;
}
if ( is_object( $value ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Cannot stabilize objects. Convert the object to an array first.' ), '5.5.0' );
return $value;
}
ksort( $value );
foreach ( $value as $k => $v ) {
$value[ $k ] = rest_stabilize_value( $v );
}
return $value;
}