[wp-trac] [WordPress Trac] #40889: REST API: New terms creation with meta causes PHP Notice
WordPress Trac
noreply at wordpress.org
Wed May 31 04:49:35 UTC 2017
#40889: REST API: New terms creation with meta causes PHP Notice
--------------------------+------------------------------
Reporter: caercam | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 4.7
Severity: normal | Resolution:
Keywords: | Focuses: rest-api
--------------------------+------------------------------
Comment (by TimothyBlynJacobs):
I think a better way to patch this would be to pass the `term_id` to the
meta controller as opposed to updating the request object. This would
match both how the `update_item` callback is written and how the [Post
Controller https://github.com/WordPress/WordPress/blob/master/wp-includes
/rest-api/endpoints/class-wp-rest-posts-controller.php#L598] works and
would keep the request object unmodified which might lead to some issues
otherwise.
For example, a simple approach for writing an additional field for the
REST API would be to check against the presence of an `id` parameter to
determine if it is an update or a create request ( matching WP internals
). Checking against the HTTP method would probably be better, but I can
easily imagine someone writing code like this.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40889#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list