WordPress.org

Make WordPress Core

Ticket #16645: 16645.diff

File 16645.diff, 783 bytes (added by garyc40, 4 years ago)

don't modify author unless specifically told to do so

  • wp-admin/includes/post.php

    diff --git wp-admin/includes/post.php wp-admin/includes/post.php
    index 12cbaa0..b1eb304 100644
    function _wp_translate_postdata( $update = false, $post_data = null ) { 
    3737        if (!empty ( $post_data['post_author_override'] ) ) { 
    3838                $post_data['post_author'] = (int) $post_data['post_author_override']; 
    3939        } else { 
    40                 if (!empty ( $post_data['post_author'] ) ) { 
     40                if ( ! empty ( $post_data['post_author'] ) ) 
    4141                        $post_data['post_author'] = (int) $post_data['post_author']; 
    42                 } else { 
    43                         $post_data['post_author'] = (int) $post_data['user_ID']; 
    44                 } 
     42                else 
     43                        $post_data['post_author'] = (int) get_post( $post_data['ID'] )->post_author; 
    4544        } 
    4645 
    4746        $ptype = get_post_type_object( $post_data['post_type'] );