acf_untrash_field() ACF 5.0.0
Restores a field from the trash.
Хуки из функции
Возвращает
true/false. True if field was trashed.
Использование
acf_untrash_field( $id );
- $id((число/строка))
- The field ID, key or name.
Список изменений
С версии 5.0.0 | Введена. |
Код acf_untrash_field() acf untrash field ACF 5.9.1
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;
}