[wp-trac] [WordPress Trac] #32991: wp_delete_post() does not return a WP_Post object
WordPress Trac
noreply at wordpress.org
Fri Jul 31 12:06:22 UTC 2015
#32991: wp_delete_post() does not return a WP_Post object
------------------------------------------------+--------------------------
Reporter: johnbillion | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future
Component: Posts, Post Types | Release
Severity: normal | Version:
Keywords: needs-docs needs-patch 2nd-opinion | Resolution:
| Focuses:
------------------------------------------------+--------------------------
Comment (by flixos90):
This patch adjusts `wp_delete_post()`, `wp_delete_attachment()`,
`wp_trash_post()` and `wp_untrash_post()` to all return a `WP_Post` object
(or `null` if object cannot be found or `false` on failure). What do you
think, is that an adequate solution?
Another question is whether the `null` is really needed. We could just
return `false` on ''any'' kind of failure (like the documentation states).
It would be more straightforward - on the other hand, maybe people use the
exact return value to distinguish between the type of error (`null` always
means "post not found").
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32991#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list