WordPress.org

Make WordPress Core

Ticket #20046: 20046.diff

File 20046.diff, 886 bytes (added by jeremyfelt, 6 years ago)
  • post.php

     
    36323632        if ( ! in_array( $post_status, array( 'inherit', 'private' ) ) )
    36333633                $post_status = 'inherit';
    36343634
    3635         // Make sure we set a valid category.
    3636         if ( !isset($post_category) || 0 == count($post_category) || !is_array($post_category) ) {
    3637                 // 'post' requires at least one category.
    3638                 if ( 'post' == $post_type )
    3639                         $post_category = array( get_option('default_category') );
    3640                 else
    3641                         $post_category = array();
    3642         }
    3643 
    36443635        // Are we updating or creating?
    36453636        if ( !empty($ID) ) {
    36463637                $update = true;
     
    37233714                $wpdb->update( $wpdb->posts, compact("post_name"), array( 'ID' => $post_ID ) );
    37243715        }
    37253716
    3726         wp_set_post_categories($post_ID, $post_category);
    3727 
    37283717        if ( $file )
    37293718                update_attached_file( $post_ID, $file );
    37303719