Ticket #20462: post-category-nonsense.diff
| File post-category-nonsense.diff, 1.2 KB (added by wonderboymusic, 8 months ago) |
|---|
-
wp-includes/post.php
2811 2811 $postarr = add_magic_quotes($postarr); 2812 2812 } 2813 2813 2814 // First, get all of the original fields 2815 $post = get_post($postarr['ID'], ARRAY_A); 2814 $post = array(); 2815 if ( ! empty( $postarr['ID'] ) ) { 2816 // First, get all of the original fields 2817 $post = get_post($postarr['ID'], ARRAY_A); 2816 2818 2817 // Escape data pulled from DB. 2818 $post = add_magic_quotes($post); 2819 // Escape data pulled from DB. 2820 $post = add_magic_quotes($post); 2821 } 2819 2822 2820 2823 // Passed post category list overwrites existing category list if not empty. 2821 if ( isset($postarr['post_category']) && is_array($postarr['post_category']) 2822 && 0 != count($postarr['post_category']) ) 2823 $post_cats = $postarr['post_category']; 2824 else 2825 $post_cats = $post['post_category']; 2824 $post_cats = empty( $post['post_category'] ) ? array() : (array) $post['post_category']; 2826 2825 2827 2826 // Drafts shouldn't be assigned a date unless explicitly done so by the user 2828 2827 if ( isset( $post['post_status'] ) && in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
