WordPress.org

Make WordPress Core

Ticket #15036: 15036.2.diff

File 15036.2.diff, 1012 bytes (added by scribu, 6 years ago)
  • wp-includes/post.php

    diff --git wp-includes/post.php wp-includes/post.php
    index 2a28f20..1841590 100644
    function wp_insert_post($postarr, $wp_error = false) { 
    27102710 * @since 1.0.0
    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.
     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.
    27142715 */
    2715 function wp_update_post($postarr = array()) {
     2716function wp_update_post( $postarr = array(), $wp_error = false ) {
    27162717        if ( is_object($postarr) ) {
    27172718                // non-escaped post was passed
    27182719                $postarr = get_object_vars($postarr);
    function wp_update_post($postarr = array()) { 
    27502751        if ($postarr['post_type'] == 'attachment')
    27512752                return wp_insert_attachment($postarr);
    27522753
    2753         return wp_insert_post($postarr);
     2754        return wp_insert_post( $postarr, $wp_error );
    27542755}
    27552756
    27562757/**