[wp-trac] [WordPress Trac] #48478: Allow omitting meta keys from the REST API response if they do not exist
WordPress Trac
noreply at wordpress.org
Thu Oct 31 22:54:18 UTC 2019
#48478: Allow omitting meta keys from the REST API response if they do not exist
--------------------------------+-----------------------------
Reporter: TimothyBlynJacobs | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version: 4.7
Severity: normal | Keywords: needs-patch
Focuses: rest-api |
--------------------------------+-----------------------------
Currently, the REST API will include all `show_in_rest` registered meta
keys in a response, even if that meta key has no value. When the meta key
has no value, either the empty value or a custom default in
`show_in_rest.schema.default` is used.
If an API client PUTs back this response, the meta key will be created
with this default value. This may be undesirable if a user hasn't actually
interacted with that meta key.
This could be addressed by allowing the user to specify that the meta key
should not be included in the REST API if it does not exist. For instance,
`show_in_rest.omit_if_not_exists`.
Related Gutenberg ticket:
https://github.com/WordPress/gutenberg/issues/17864
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48478>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list