WordPress.org

Make WordPress Core

Ticket #2359: functions-post.php.diff

File functions-post.php.diff, 2.1 KB (added by nevans, 12 years ago)
  • functions-post.php

     
    233233        $post_content    = apply_filters('content_save_pre',   $post_content);
    234234        $post_excerpt    = apply_filters('excerpt_save_pre',   $post_excerpt);
    235235        $post_title      = apply_filters('title_save_pre',     $post_title);
    236         $post_category   = apply_filters('category_save_pre',  $post_category);
    237236        $post_name       = apply_filters('name_save_pre',      $post_name);
    238237        $comment_status  = apply_filters('comment_status_pre', $comment_status);
    239238        $ping_status     = apply_filters('ping_status_pre',    $ping_status);
    240239        $post_mime_type  = apply_filters('post_mime_type_pre', $post_mime_type);
    241240
    242         // Make sure we set a valid category
    243         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 
    248241        if ( empty($post_author) )
    249242                $post_author = $user_ID;
    250243
     
    345338                $wpdb->query( "UPDATE $wpdb->posts SET post_name = '$post_name' WHERE ID = '$post_ID'" );
    346339        }
    347340
    348         wp_set_post_cats('', $post_ID, $post_category);
    349 
    350341        if ( $file )
    351342                add_post_meta($post_ID, '_wp_attached_file', $file);
    352343
     
    378369
    379370        $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID = $postid");
    380371
    381         $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = $postid");
    382 
    383372        $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = $postid");
    384373
     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
    385381        if ( ! empty($meta['thumb']) ) {
    386382                // Don't delete the thumb if another attachment uses it
    387383                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"))