Make WordPress Core


Ignore:
Timestamp:
02/21/2017 07:02:14 AM (8 years ago)
Author:
dd32
Message:

Customize: Extend auto-draft life of a customize_changeset post whenever modified.

Keep bumping the date for the auto-draft to preserve it from garbage-collection via wp_delete_auto_drafts() after 7 days.

Props westonruter.
Merges [40041] to the 4.7 branch.
See #30937.
Fixes #39713.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/class-wp-customize-manager.php

    r40098 r40099  
    24952495            $post_array['post_date_gmt'] = $args['date_gmt'];
    24962496            $post_array['post_date'] = get_date_from_gmt( $args['date_gmt'] );
     2497        } elseif ( $changeset_post_id && 'auto-draft' === get_post_status( $changeset_post_id ) ) {
     2498            /*
     2499             * Keep bumping the date for the auto-draft whenever it is modified;
     2500             * this extends its life, preserving it from garbage-collection via
     2501             * wp_delete_auto_drafts().
     2502             */
     2503            $post_array['post_date'] = current_time( 'mysql' );
     2504            $post_array['post_date_gmt'] = '';
    24972505        }
    24982506
Note: See TracChangeset for help on using the changeset viewer.