WP_REST_Meta_Fields::get_empty_value_for_type()
Gets the empty value for a schema type.
Method of the class: WP_REST_Meta_Fields{}
No Hooks.
Return
Mixed
.
Usage
$result = WP_REST_Meta_Fields::get_empty_value_for_type( $type );
- $type(string) (required)
- The schema type.
Changelog
Since 5.3.0 | Introduced. |
WP_REST_Meta_Fields::get_empty_value_for_type() WP REST Meta Fields::get empty value for type code WP 6.6.1
protected static function get_empty_value_for_type( $type ) { switch ( $type ) { case 'string': return ''; case 'boolean': return false; case 'integer': return 0; case 'number': return 0.0; case 'array': case 'object': return array(); default: return null; } }