WordPress.org

Make WordPress Core

Ticket #15036: 15036.diff

File 15036.diff, 1.1 KB (added by scribu, 4 years ago)
  • wp-includes/post.php

     
    26352635 * @since 1.0.0 
    26362636 * 
    26372637 * @param array|object $postarr Post data. Arrays are expected to be escaped, objects are not. 
    2638  * @return int 0 on failure, Post ID on success. 
     2638 * @param bool $wp_error Optional. Allow return of WP_Error on failure. 
     2639 * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success. 
    26392640 */ 
    2640 function wp_update_post($postarr = array()) { 
     2641function wp_update_post( $postarr = array(), $wp_error = false ) { 
    26412642        if ( is_object($postarr) ) { 
    26422643                // non-escaped post was passed 
    26432644                $postarr = get_object_vars($postarr); 
     
    26752676        if ($postarr['post_type'] == 'attachment') 
    26762677                return wp_insert_attachment($postarr); 
    26772678 
    2678         return wp_insert_post($postarr); 
     2679        return wp_insert_post( $postarr, $wp_error ); 
    26792680} 
    26802681 
    26812682/** 
     
    52365237} 
    52375238add_filter( 'wp_get_object_terms', '_post_format_wp_get_object_terms' ); 
    52385239 
    5239 ?> 
    5240  No newline at end of file 
     5240?>