ACF_Internal_Post_Type::untrash_postpublicACF 6.1

Restores an ACF post from the trash.

Метод класса: ACF_Internal_Post_Type{}

Хуки из метода

Возвращает

true|false.

Использование

$ACF_Internal_Post_Type = new ACF_Internal_Post_Type();
$ACF_Internal_Post_Type->untrash_post( $id );
$id(int|строка)
The ID of the ACF post to untrash.

Список изменений

С версии 6.1 Введена.

Код ACF_Internal_Post_Type::untrash_post() ACF 6.4.2

public function untrash_post( $id = 0 ) {
	// Disable filters to ensure ACF loads data from DB.
	acf_disable_filters();

	$post = $this->get_post( $id );
	if ( ! $post || ! $post['ID'] ) {
		return false;
	}

	wp_untrash_post( $post['ID'] );
	$this->flush_post_cache( $post );

	/**
	 * Fires immediately after an ACF post has been untrashed.
	 *
	 * @date 12/02/2014
	 * @since 5.0.0
	 *
	 * @param array $post The ACF post array.
	 */
	do_action( "acf/untrash_{$this->hook_name}", $post );

	return true;
}