[wp-trac] [WordPress Trac] #53942: Non-single post meta multiple value update breaks post save through REST API

WordPress Trac noreply at wordpress.org
Tue Aug 17 13:00:32 UTC 2021


#53942: Non-single post meta multiple value update breaks post save through REST
API
----------------------------+-----------------------------
 Reporter:  iknowsomething  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  assigned
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  REST API        |    Version:  5.8
 Severity:  blocker         |   Keywords:  needs-patch
  Focuses:  rest-api        |
----------------------------+-----------------------------
 This is a follow-up to #52787.

 Same situation as in #52787, but this time while updating **non-single**
 meta **multiple values at once** like `{ meta: { metaKey: [1, 2, 3] } }`,
 REST API fires `update_multi_meta_value()`, which tries first to delete
 old values in the database. When no meta value is present in database,
 `get_metadata()` returns defaults as `$current_values` and then trying to
 delete them anyway (non-existent in fact). This causes
 `update_multi_meta_value()` to return
 `WP_Error('rest_meta_database_error')` on `delete_metadata()` failure.

 BTW, error messages could be more specific from `'Could not update the
 meta value of %s in database.'` to `'Could not update/delete...'` and
 `'Could not update/add...'`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53942>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list