Use wp_update_post() rather than wp_insert_post() in wp_publish_post() to avoid stomping of values like categories. props ericmann, fixes #22167. see #21963.

git-svn-id: http://core.svn.wordpress.org/trunk@22189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-10-11 17:36:59 +00:00
parent 15867287fc
commit fd56fd3563
1 changed files with 2 additions and 2 deletions

View File

@ -2865,7 +2865,7 @@ function wp_update_post( $postarr = array(), $wp_error = false ) {
* Publish a post by transitioning the post status. * Publish a post by transitioning the post status.
* *
* @since 2.1.0 * @since 2.1.0
* @uses wp_insert_post() * @uses wp_update_post()
* *
* @param mixed $post Post ID or object. * @param mixed $post Post ID or object.
*/ */
@ -2876,7 +2876,7 @@ function wp_publish_post( $post ) {
return; return;
$post->post_status = 'publish'; $post->post_status = 'publish';
wp_insert_post( $post ); wp_update_post( $post );
} }
/** /**