Ticket #2359: functions-post.php.diff
File functions-post.php.diff, 2.1 KB (added by , 18 years ago) |
---|
-
functions-post.php
233 233 $post_content = apply_filters('content_save_pre', $post_content); 234 234 $post_excerpt = apply_filters('excerpt_save_pre', $post_excerpt); 235 235 $post_title = apply_filters('title_save_pre', $post_title); 236 $post_category = apply_filters('category_save_pre', $post_category);237 236 $post_name = apply_filters('name_save_pre', $post_name); 238 237 $comment_status = apply_filters('comment_status_pre', $comment_status); 239 238 $ping_status = apply_filters('ping_status_pre', $ping_status); 240 239 $post_mime_type = apply_filters('post_mime_type_pre', $post_mime_type); 241 240 242 // Make sure we set a valid category243 if (0 == count($post_category) || !is_array($post_category)) {244 $post_category = array(get_option('default_category'));245 }246 $post_cat = $post_category[0];247 248 241 if ( empty($post_author) ) 249 242 $post_author = $user_ID; 250 243 … … 345 338 $wpdb->query( "UPDATE $wpdb->posts SET post_name = '$post_name' WHERE ID = '$post_ID'" ); 346 339 } 347 340 348 wp_set_post_cats('', $post_ID, $post_category);349 350 341 if ( $file ) 351 342 add_post_meta($post_ID, '_wp_attached_file', $file); 352 343 … … 378 369 379 370 $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID = $postid"); 380 371 381 $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = $postid");382 383 372 $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = $postid"); 384 373 374 // It's probably a good idea to keep this DELETE statement 375 // for the time being (despite WP no longer setting cats for 376 // uploaded images) so it'll clean up after previous versions 377 // if users delete posts. 378 // Someone may want to remove this in a year or so... 379 $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = $postid"); 380 385 381 if ( ! empty($meta['thumb']) ) { 386 382 // Don't delete the thumb if another attachment uses it 387 383 if (! $foo = $wpdb->get_row("SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE '%".$wpdb->escape($meta['thumb'])."%' AND post_id <> $postid"))