acf_untrash_field()
acf_untrash_field
Restores a field from the trash.
Хуки из функции
Возвращает
true|false. True if field was trashed.
Использование
acf_untrash_field( $id );
- $id((int|string))
- The field ID, key or name.
Список изменений
| С версии 5.0.0 | Введена. |
Код acf_untrash_field() acf untrash field ACF 6.4.2
function acf_untrash_field( $id = 0 ) {
// Get the field.
$field = acf_get_field( $id );
// Bail early if field was not found.
if ( ! $field || ! $field['ID'] ) {
return false;
}
// Untrash post.
wp_untrash_post( $field['ID'], true );
// Flush field cache.
acf_flush_field_cache( $field );
/**
* Fires immediately after a field has been trashed.
*
* @date 12/02/2014
* @since 5.0.0
*
* @param array $field The field array.
*/
do_action( 'acf/untrash_field', $field );
// Return true.
return true;
}