[wp-trac] [WordPress Trac] #39959: Clarify parameters for callbacks for `register_rest_field()`

WordPress Trac noreply at wordpress.org
Thu Mar 23 00:15:41 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 flixos90):

 To give a precise example:
 https://core.trac.wordpress.org/browser/trunk/src/wp-includes/rest-
 api/endpoints/class-wp-rest-controller.php#L432 passes an object to the
 `update_callback` passed to `register_rest_field()`, but
 https://core.trac.wordpress.org/browser/trunk/src/wp-includes/rest-
 api/fields/class-wp-rest-meta-fields.php#L124 which is passed to
 `register_rest_field()` as an `update_callback` accepts an object ID only.
 So which of the two is right? Should `register_rest_field()` callbacks
 accept an object or an ID?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39959#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list