Make WordPress Core


Ignore:
Timestamp:
02/05/2017 06:38:57 AM (10 years ago)
Author:
westonruter
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.

See #30937.
Fixes #39713.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r39951 r40041  
    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.