[wp-trac] [WordPress Trac] #49648: WordPress 5.4 RC2 : _fields parameter doesn't get nested proprieties from custom attribute
WordPress Trac
noreply at wordpress.org
Wed Mar 25 21:59:43 UTC 2020
#49648: WordPress 5.4 RC2 : _fields parameter doesn't get nested proprieties from
custom attribute
--------------------------------------+-------------------------
Reporter: Dudo | Owner: kadamwhite
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 5.5
Component: REST API | Version: 5.4
Severity: minor | Resolution:
Keywords: has-patch has-unit-tests | Focuses: rest-api
--------------------------------------+-------------------------
Changes (by kadamwhite):
* keywords: => has-patch has-unit-tests
* owner: (none) => kadamwhite
* status: new => accepted
* milestone: Awaiting Review => 5.5
Comment:
Nice catch @Dudo, thank you for the ticket.
This happens because we were checking for field names with `in_array` in
the REST Controller when iterating through additional fields, instead of
using the more powerful new `rest_is_field_included` method. Switching to
using that method causes the top-level field to be included if any child
is present. Once that field is included, then the filtering logic (which
runs on a hook within the server) can properly do its job to filter down
to leaf nodes.
@TimothyBlynJacobs can you check my work here?
We could pull out the global field resets into a separate commit, those
aren't strictly necessary for this patch, it just felt like missing
cleanup in the test suite.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49648#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list