WP_Customize_Manager::dismiss_user_auto_draft_changesets()
Dismisses all of the current user's auto-drafts (other than the present one).
Метод класса: WP_Customize_Manager{}
Хуков нет.
Возвращает
int
. The number of auto-drafts that were dismissed.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->dismiss_user_auto_draft_changesets();
Список изменений
С версии 4.9.0 | Введена. |
Код WP_Customize_Manager::dismiss_user_auto_draft_changesets() WP Customize Manager::dismiss user auto draft changesets WP 6.1.1
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; }