[wp-trac] [WordPress Trac] #40889: REST API: New terms creation with meta causes PHP Notice

WordPress Trac noreply at wordpress.org
Wed May 31 14:24:13 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 caercam):

 Good point. Using `$term->term_id` was my initial approach, but then I
 figured having an undefined `$request['id']` might be mistakenly
 interpreted as a failure to create the term even though it was properly
 inserted.

 You're right a missing `$request['id']` value could be used to determine
 if the term was created, though I'd personally go with a HTTP method
 check; that being said, `WP_REST_Server::EDITABLE` also supports `POST` in
 addition to `PUT` and `PATCH`, which may be cause more confusions yet to
 distinguish updates from creations. I'll add a patch using​
 `$term->term_id` instead.

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


More information about the wp-trac mailing list