WordPress.org

Make WordPress Core

Ticket #45322: fix-wp-editpost-draft-dates.2.patch

File fix-wp-editpost-draft-dates.2.patch, 960 bytes (added by redsweater, 10 months ago)

Tests confirming the fix included in the other attachment

  • src/wp-includes/class-wp-xmlrpc-server.php

    diff --git src/wp-includes/class-wp-xmlrpc-server.php src/wp-includes/class-wp-xmlrpc-server.php
    index 5c8ee133c6..5cb59d8175 100644
    class wp_xmlrpc_server extends IXR_Server { 
    17051705                        $post['post_date_gmt'] = $this->_convert_date( $post['post_date_gmt'] );
    17061706                }
    17071707
     1708                // If the API client did not provide post_date then we must not perpetuate the
     1709                // value that was stored in the database, or it will appear to be an intentional
     1710                // edit. Conveying it here as if it were coming from the API client will cause an
     1711                // otherwise zeroed out post_date_gmt to get set with the value that was originally
     1712                // stored in the database when the draft was created.
     1713                if ( !isset( $content_struct['post_date'] ) ) {
     1714                        unset( $post['post_date'] );
     1715                }
     1716
    17081717                $this->escape( $post );
    17091718                $merged_content_struct = array_merge( $post, $content_struct );
    17101719