ACF_Internal_Post_Type::untrash_postpublicACF 6.1

Restores an ACF post from the trash.

Method of the class: ACF_Internal_Post_Type{}

Hooks from the method

Returns

true|false.

Usage

$ACF_Internal_Post_Type = new ACF_Internal_Post_Type();
$ACF_Internal_Post_Type->untrash_post( $id );
$id(int|string)
The ID of the ACF post to untrash.

Changelog

Since 6.1 Introduced.

ACF_Internal_Post_Type::untrash_post() code ACF 6.8.8

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;
}