Function: _wp_keep_alive_customize_changeset_dependent_auto_drafts

_wp_keep_alive_customize_changeset_dependent_auto_drafts( string $new_status, string $old_status, WP_Post $post )

Make sure that auto-draft posts get their post_date bumped or status changed to draft to prevent premature garbage-collection.

Shortcut: wkaccdad

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.

When a changeset is updated but remains an auto-draft, ensure the post_date for the auto-draft posts remains the same so that it will be garbage-collected at the same time by wp_delete_auto_drafts(). Otherwise, if the changeset is updated to be a draft then update the posts to have a far-future post_date so that they will never be garbage collected unless the changeset post itself is deleted.

When a changeset is updated to be a persistent draft or to be scheduled for publishing, then transition any dependent auto-drafts to a draft status so that they likewise will not be garbage-collected but also so that they can be edited in the admin before publishing since there is not yet a post/page editing flow in the Customizer. See #39752.


Name Type(s) Default Value Description
$new_status string

Transition to this post status.

$old_status string

Previous post status.

$post WP_Post

Post data.

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.