WordPress.org

Make WordPress Core

Changeset 37043


Ignore:
Timestamp:
03/22/2016 03:09:05 PM (6 years ago)
Author:
rachelbaker
Message:

XMLRPC: Fix bug where draft posts couldn’t be published in the future, and would publish immediately.

Resolves bug introduced in [r34572], in which editing a Post via the XMLRPC API with a draft post_status, where the post_status changes from draft->publish with a future post_date set for the publish action, will have the future post_date disregarded and the Post will be published immediately. The expected behavior is that the post_date is used to schedule the Post to be published in the future.

Fixes #35874.

Props redsweater, rachelbaker, DrewAPicture

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r37025 r37043  
    13651365        }
    13661366
     1367        // Default to not flagging the post date to be edited unless it's intentional.
     1368        $post_data['edit_date'] = false;
     1369
    13671370        if ( ! empty( $dateCreated ) ) {
    13681371            $post_data['post_date'] = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
    13691372            $post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, 'GMT' );
     1373
     1374            // Flag the post date to be edited.
     1375            $post_data['edit_date'] = true;
    13701376        }
    13711377
     
    53765382            $dateCreated = $content_struct['dateCreated']->getIso();
    53775383
     5384        // Default to not flagging the post date to be edited unless it's intentional.
     5385        $edit_date = false;
     5386
    53785387        if ( !empty( $dateCreated ) ) {
    53795388            $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
    53805389            $post_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');
     5390
     5391            // Flag the post date to be edited.
     5392            $edit_date = true;
    53815393        } else {
    53825394            $post_date     = $postdata['post_date'];
     
    53855397
    53865398        // We've got all the data -- post it.
    5387         $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input', 'page_template');
     5399        $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'edit_date', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input', 'page_template');
    53885400
    53895401        $result = wp_update_post($newpost, true);
Note: See TracChangeset for help on using the changeset viewer.