WordPress at a glance
function is not described

WP_Customize_Manager::dismiss_user_auto_draft_changesets() protected WP 4.9.0

Dismiss all of the current user's auto-drafts (other than the present one).

{} It's a method of the class: WP_Customize_Manager{}

No Hooks.

Return

Int. The number of auto-drafts that were dismissed.

Usage

// protected - for code of main (parent) or child class
$result = $this->dismiss_user_auto_draft_changesets();

Changelog

Since 4.9.0 Introduced.

Code of WP_Customize_Manager::dismiss_user_auto_draft_changesets() WP 5.7.2

<?php
protected function dismiss_user_auto_draft_changesets() {
	$changeset_autodraft_posts = $this->get_changeset_posts(
		array(
			'post_status'               => 'auto-draft',
			'exclude_restore_dismissed' => true,
			'posts_per_page'            => -1,
		)
	);
	$dismissed                 = 0;
	foreach ( $changeset_autodraft_posts as $autosave_autodraft_post ) {
		if ( $autosave_autodraft_post->ID === $this->changeset_post_id() ) {
			continue;
		}
		if ( update_post_meta( $autosave_autodraft_post->ID, '_customize_restore_dismissed', true ) ) {
			$dismissed++;
		}
	}
	return $dismissed;
}