[wp-trac] [WordPress Trac] #47773: wp_trash_post() ignores errors from wp_update_post()

WordPress Trac noreply at wordpress.org
Thu Jul 25 17:48:37 UTC 2019


#47773: wp_trash_post() ignores errors from wp_update_post()
-------------------------------+-----------------------------
 Reporter:  siliconforks       |      Owner:  (none)
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  5.2.2
 Severity:  normal             |   Keywords:
  Focuses:                     |
-------------------------------+-----------------------------
 The documentation for `wp_trash_post()` states that it returns "false or
 null on failure".  It does indeed do that for some failure conditions, but
 it calls `wp_update_post()` without checking its return value, so it just
 ignores any errors which occur there.

 https://core.trac.wordpress.org/browser/tags/5.2.2/src/wp-
 includes/post.php?rev=45549#L2985

 One of the consequences of this is that, in the admin section, if a user
 trashes a post and the `wp_update_post()` call fails for some reason, the
 success message "1 post moved to the Trash" will be displayed even though
 the post did not actually get moved to the trash.

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


More information about the wp-trac mailing list