diff --git a/wp-includes/functions-post.php b/wp-includes/functions-post.php index a4123863a9..c88cb89b49 100644 --- a/wp-includes/functions-post.php +++ b/wp-includes/functions-post.php @@ -87,18 +87,17 @@ function wp_update_post($postarr = array()) { global $wpdb; // First get all of the original fields - extract(wp_get_single_post($postarr['ID'],ARRAY_A)); + extract(wp_get_single_post($postarr['ID'], ARRAY_A)); // Now overwrite any changed values being passed in extract($postarr); - + // Make sure we set a valid category - if (0 == count($post_category) || !is_array($post_category)) { + if ( 0 == count($post_category) || !is_array($post_category) ) $post_category = array($post_default_category); - } // Do some escapes for safety - $post_title = $wpdb->escape($post_title); + $post_title = $wpdb->escape($post_title); $post_excerpt = $wpdb->escape($post_excerpt); $post_content = $wpdb->escape($post_content); @@ -121,8 +120,10 @@ function wp_update_post($postarr = array()) { $result = $wpdb->query($sql); - wp_set_post_cats('',$ID,$post_category); - + wp_set_post_cats('', $ID, $post_category); + + do_action('edit_post', $ID); + return $wpdb->rows_affected; }