[wp-trac] [WordPress Trac] #39732: Allowing wp_update_comment() to return WP_Error
WordPress Trac
noreply at wordpress.org
Sat Jun 24 15:49:23 UTC 2017
#39732: Allowing wp_update_comment() to return WP_Error
------------------------------------------+--------------------
Reporter: enrico.sorcinelli | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.8.1
Component: Comments | Version: 4.8
Severity: normal | Resolution:
Keywords: has-unit-tests needs-refresh | Focuses:
------------------------------------------+--------------------
Comment (by enrico.sorcinelli):
I updated the patch based on @jnylen0 suggestions in order to keep the
current behaviour of `wp_update_comment`. `wp_update_comment` now accepts
a second parameter `$wp_error` (default to `false`). If `true` then we
return `WP_Error` on failure.
So, there will be the following possible return paths from
`wp_update_comment`:
- Number of commented lines updated on success (`0` or `1`).
- `false` or `WP_Error` on failure.
I also updated the core `wp_update_comment` calls by setting `$wp_error`
to `true`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39732#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list