WordPress.org

Make WordPress Core

Ticket #20462: 20462.diff

File 20462.diff, 964 bytes (added by scribu, 2 years ago)
  • wp-includes/post.php

    diff --git wp-includes/post.php wp-includes/post.php
    index 8e8a387..e3a6f21 100644
    function wp_update_post($postarr = array()) { 
    26872687        $post = add_magic_quotes($post); 
    26882688 
    26892689        // Passed post category list overwrites existing category list if not empty. 
    2690         if ( isset($postarr['post_category']) && is_array($postarr['post_category']) 
    2691                          && 0 != count($postarr['post_category']) ) 
     2690        if ( isset( $postarr['post_category'] ) && is_array( $postarr['post_category'] ) && !empty( $postarr['post_category'] ) ) 
    26922691                $post_cats = $postarr['post_category']; 
    2693         else 
     2692        elseif( isset( $post['post_category'] ) ) 
    26942693                $post_cats = $post['post_category']; 
     2694        else 
     2695                $post_cats = array(); 
    26952696 
    26962697        // Drafts shouldn't be assigned a date unless explicitly done so by the user 
    26972698        if ( isset( $post['post_status'] ) && in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&