ACF_Field_Group::untrash_post
Restores an ACF field group and related fields from the trash.
Метод класса: ACF_Field_Group{}
Хуки из метода
Возвращает
true|false.
Использование
$ACF_Field_Group = new ACF_Field_Group(); $ACF_Field_Group->untrash_post( $id );
- $id(int|строка)
- The ID of the ACF post to untrash.
Список изменений
| С версии 6.1 | Введена. |
Код ACF_Field_Group::untrash_post() ACF Field Group::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;
}
$fields = acf_get_fields( $post );
if ( $fields ) {
foreach ( $fields as $field ) {
acf_untrash_field( $field['ID'] );
}
}
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;
}