[wp-trac] [WordPress Trac] #15036: Add 2nd boolean parameter of wp_error to wp_update_post() to allow passthru to wp_insert_post()

WordPress Trac wp-trac at lists.automattic.com
Sun Mar 20 14:14:19 UTC 2011


#15036: Add 2nd boolean parameter of wp_error to wp_update_post() to allow passthru
to wp_insert_post()
------------------------------+-----------------------------
 Reporter:  mikeschinkel      |       Owner:
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  Future Release
Component:  Post Types        |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |
------------------------------+-----------------------------
Changes (by scribu):

 * keywords:  needs-patch => has-patch commit


Old description:

> Currently `wp_insert_post()` accepts `wp_error` as a second parameter; if
> `true` is passed then `wp_insert_post()` is allowed to return a
> `WP_Error` object, if `false` it can only return a zero (0) on failure.
>
> `wp_update_post()` currently sets values and then delegates the work of
> updating to `wp_insert_post()`. ''Unfortunately''  `wp_update_post()`
> does '''''not''''' accept a second boolean parameter of  `wp_error`
> meaning it cannot receive back the same failure information that
> `wp_insert_post()` can.
>
> '''So this request is very simple: accept `wp_error` as an optional
> second parameter for `wp_update_post()` with a default of `false` and
> then to pass wp_error on through to `wp_insert_post()`.'''

New description:

 Currently `wp_insert_post()` accepts `wp_error` as a second parameter; if
 `true` is passed then `wp_insert_post()` is allowed to return a `WP_Error`
 object, if `false` it can only return a zero (0) on failure.

 `wp_update_post()` currently sets values and then delegates the work of
 updating to `wp_insert_post()`. ''Unfortunately''  `wp_update_post()` does
 '''''not''''' accept a second boolean parameter of  `wp_error` meaning it
 cannot receive back the same failure information that `wp_insert_post()`
 can.

 So this request is very simple: accept `wp_error` as an optional second
 parameter for `wp_update_post()` with a default of `false` and then to
 pass wp_error on through to `wp_insert_post()`.

--

Comment:

 Ran into this myself.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15036#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list