You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"register_meta was called incorrectly. When registering an "array" meta type to show in the REST API, you must specify the schema for each array item in "show_in_rest.schema.items"
The docs say we can either pass schema or prepare_callback:
show_in_rest bool|array:
When registering complex meta values this argument may optionally be an array with 'schema' or 'prepare_callback' keys instead of a boolean.
from register_meta
if ( false !== $args['show_in_rest'] && 'array' === $args['type'] ) {
if ( ! is_array( $args['show_in_rest'] ) || ! isset( $args['show_in_rest']['schema']['items'] ) ) {
_doing_it_wrong( __FUNCTION__, __( 'When registering an "array" meta type to show in the REST API, you must specify the schema for each array item in "show_in_rest.schema.items".' ), '5.3.0' );
returnfalse;
}
}
There's a notice in when calling register_meta:
Caution
"register_meta was called incorrectly. When registering an "array" meta type to show in the REST API, you must specify the schema for each array item in "show_in_rest.schema.items"
The docs say we can either pass schema or prepare_callback:
meaning:
or
or
Note
but! it only checks for schema.items
https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/meta.php#L1475