diff --git a/wp-includes/post.php b/wp-includes/post.php index a25afaad2c..5c44e6a692 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1611,12 +1611,15 @@ function wp_insert_post($postarr = array(), $wp_error = false) { * * @since 1.0.0 * - * @param array|object $postarr Post data. + * @param array|object $postarr Post data. Arrays are expected to be escaped, objects are not. * @return int 0 on failure, Post ID on success. */ function wp_update_post($postarr = array()) { - if ( is_object($postarr) ) + if ( is_object($postarr) ) { + // non-escaped post was passed $postarr = get_object_vars($postarr); + $postarr = add_magic_quotes($postarr); + } // First, get all of the original fields $post = wp_get_single_post($postarr['ID'], ARRAY_A);