Changeset 46186 for trunk/src/wp-includes/meta.php
- Timestamp:
- 09/19/2019 02:35:47 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/meta.php
r45915 r46186 1116 1116 * `$sanitize_callback` and `$auth_callback` have been folded into this array. 1117 1117 * @since 4.9.8 The `$object_subtype` argument was added to the arguments array. 1118 * @since 5.3.0 Valid meta types expanded to include "array" and "object". 1118 1119 * 1119 1120 * @param string $object_type Type of object this meta is registered to. … … 1122 1123 * Data used to describe the meta key when registered. 1123 1124 * 1124 * @type string $object_subtype A subtype; e.g. if the object type is "post", the post type. If left empty, 1125 * the meta key will be registered on the entire object type. Default empty. 1126 * @type string $type The type of data associated with this meta key. 1127 * Valid values are 'string', 'boolean', 'integer', and 'number'. 1128 * @type string $description A description of the data attached to this meta key. 1129 * @type bool $single Whether the meta key has one value per object, or an array of values per object. 1130 * @type string $sanitize_callback A function or method to call when sanitizing `$meta_key` data. 1131 * @type string $auth_callback Optional. A function or method to call when performing edit_post_meta, add_post_meta, and delete_post_meta capability checks. 1132 * @type bool $show_in_rest Whether data associated with this meta key can be considered public and 1133 * should be accessible via the REST API. A custom post type must also declare 1134 * support for custom fields for registered meta to be accessible via REST. 1125 * @type string $object_subtype A subtype; e.g. if the object type is "post", the post type. If left empty, 1126 * the meta key will be registered on the entire object type. Default empty. 1127 * @type string $type The type of data associated with this meta key. 1128 * Valid values are 'string', 'boolean', 'integer', 'number', 'array', and 'object'. 1129 * @type string $description A description of the data attached to this meta key. 1130 * @type bool $single Whether the meta key has one value per object, or an array of values per object. 1131 * @type string $sanitize_callback A function or method to call when sanitizing `$meta_key` data. 1132 * @type string $auth_callback Optional. A function or method to call when performing edit_post_meta, 1133 * add_post_meta, and delete_post_meta capability checks. 1134 * @type bool|array $show_in_rest Whether data associated with this meta key can be considered public and 1135 * should be accessible via the REST API. A custom post type must also declare 1136 * support for custom fields for registered meta to be accessible via REST. 1137 * When registering complex meta values this argument may optionally be an 1138 * array with 'schema' or 'prepare_callback' keys instead of a boolean. 1135 1139 * } 1136 1140 * @param string|array $deprecated Deprecated. Use `$args` instead. … … 1189 1193 $args = wp_parse_args( $args, $defaults ); 1190 1194 1195 // Require an item schema when registering array meta. 1196 if ( false !== $args['show_in_rest'] && 'array' === $args['type'] ) { 1197 if ( ! is_array( $args['show_in_rest'] ) || ! isset( $args['show_in_rest']['schema']['items'] ) ) { 1198 _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' ); 1199 1200 return false; 1201 } 1202 } 1203 1191 1204 $object_subtype = ! empty( $args['object_subtype'] ) ? $args['object_subtype'] : ''; 1192 1205
Note: See TracChangeset
for help on using the changeset viewer.