[wp-trac] [WordPress Trac] #46238: REST API: Allow conditional field registration
WordPress Trac
noreply at wordpress.org
Mon Jul 28 14:52:00 UTC 2025
#46238: REST API: Allow conditional field registration
------------------------------------------+------------------------------
Reporter: dmsnell | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version:
Severity: normal | Resolution:
Keywords: needs-patch needs-unit-tests | Focuses:
------------------------------------------+------------------------------
Comment (by priethor):
I have stumbled upon this ticket while running into a similar need, and
would like to add a third approach:
What about adding an optional flag to `register_rest_field`, e.g
`return_by_default`, defaulting to `true` to maintain backward
compatibility with existing registrations. Conceptually, the default
response without `_fields` wouldn't return "all fields" but "the default
fields".
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46238#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list