[wp-trac] [WordPress Trac] #39959: Clarify parameters for callbacks for `register_rest_field()`
WordPress Trac
noreply at wordpress.org
Wed Apr 5 19:34:21 UTC 2017
#39959: Clarify parameters for callbacks for `register_rest_field()`
--------------------------+-----------------------------
Reporter: flixos90 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: REST API | Version: 4.7
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+-----------------------------
Comment (by jnylen0):
Replying to [comment:4 flixos90]:
> So which of the two is right? Should `register_rest_field()` callbacks
accept an object or an ID?
They should accept an object. See the first code example at
https://developer.wordpress.org/rest-api/extending-the-rest-api/modifying-
responses/.
It sounds like the unused `WP_REST_Meta_Fields::register_field()` method
was never tested, and it should be updated to accept an object. Also, we
need to improve the `register_rest_field` documentation to indicate the
types/signatures of the values accepted by its `$args` argument.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39959#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list