WordPress.org

Make WordPress Core

Changeset 21213


Ignore:
Timestamp:
07/05/12 19:21:57 (5 years ago)
Author:
nacin
Message:

Allow wp_update_post() to accept the same second argument as wp_insert_post(), allowing for WP_Error return values on failure. props scribu, mikeschinkel. fixes #15036.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r21177 r21213  
    27112711 * 
    27122712 * @param array|object $postarr Post data. Arrays are expected to be escaped, objects are not. 
    2713  * @return int 0 on failure, Post ID on success. 
    2714  */ 
    2715 function wp_update_post($postarr = array()) { 
     2713 * @param bool $wp_error Optional. Allow return of WP_Error on failure. 
     2714 * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success. 
     2715 */ 
     2716function wp_update_post( $postarr = array(), $wp_error = false ) { 
    27162717    if ( is_object($postarr) ) { 
    27172718        // non-escaped post was passed 
     
    27512752        return wp_insert_attachment($postarr); 
    27522753 
    2753     return wp_insert_post($postarr); 
     2754    return wp_insert_post( $postarr, $wp_error ); 
    27542755} 
    27552756 
Note: See TracChangeset for help on using the changeset viewer.