Revert [14230]. Broke menu save. see #10122

git-svn-id: http://svn.automattic.com/wordpress/trunk@14247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-04-27 00:44:38 +00:00
parent 78930c4964
commit 418b0b7e69
1 changed files with 10 additions and 16 deletions

View File

@ -2190,7 +2190,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
$data = stripslashes_deep( $data ); $data = stripslashes_deep( $data );
$where = array( 'ID' => $post_ID ); $where = array( 'ID' => $post_ID );
if ( $update ) { if ($update) {
do_action( 'pre_post_update', $post_ID ); do_action( 'pre_post_update', $post_ID );
if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) { if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) {
if ( $wp_error ) if ( $wp_error )
@ -2229,19 +2229,13 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
// old-style tags_input // old-style tags_input
if ( isset( $tags_input ) ) if ( isset( $tags_input ) )
wp_set_post_tags( $post_ID, $tags_input ); wp_set_post_tags( $post_ID, $tags_input );
// new-style support for all taxonomies // new-style support for all tag-like taxonomies
$tax_names = get_object_taxonomies( get_post($post_ID) ); if ( !empty($tax_input) ) {
foreach ( (array)$tax_names as $taxonomy ) { foreach ( $tax_input as $taxonomy => $tags ) {
if ( 'category' == $taxonomy ) // Handled seperately. $taxonomy_obj = get_taxonomy($taxonomy);
continue; if ( current_user_can($taxonomy_obj->assign_cap) )
$taxonomy_obj = get_taxonomy($taxonomy); wp_set_post_terms( $post_ID, $tags, $taxonomy );
if ( !current_user_can($taxonomy_obj->assign_cap) ) }
continue;
if ( !$taxonomy_obj->show_ui )
continue;
$tags = isset($tax_input[$taxonomy]) ? $tax_input[$taxonomy] : array();
wp_set_post_terms( $post_ID, $tags, $taxonomy );
} }
$current_guid = get_post_field( 'guid', $post_ID ); $current_guid = get_post_field( 'guid', $post_ID );
@ -2271,7 +2265,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
wp_transition_post_status($data['post_status'], $previous_status, $post); wp_transition_post_status($data['post_status'], $previous_status, $post);
if ( $update ) if ( $update)
do_action('edit_post', $post_ID, $post); do_action('edit_post', $post_ID, $post);
do_action('save_post', $post_ID, $post); do_action('save_post', $post_ID, $post);
@ -2326,7 +2320,7 @@ function wp_update_post($postarr = array()) {
$postarr['post_date_gmt'] = ''; $postarr['post_date_gmt'] = '';
} }
if ( $postarr['post_type'] == 'attachment' ) if ($postarr['post_type'] == 'attachment')
return wp_insert_attachment($postarr); return wp_insert_attachment($postarr);
return wp_insert_post($postarr); return wp_insert_post($postarr);