acf_trash_field()
acf_trash_field
Trashes a field from the database.
Хуки из функции
Возвращает
true|false. True if field was trashed.
Использование
acf_trash_field( $id );
- $id((int|string))
- The field ID, key or name.
Список изменений
| С версии 5.0.0 | Введена. |
Код acf_trash_field() acf trash field ACF 6.4.2
function acf_trash_field( $id = 0 ) {
// Get the field.
$field = acf_get_field( $id );
// Bail early if field was not found.
if ( ! $field || ! $field['ID'] ) {
return false;
}
// Trash post.
wp_trash_post( $field['ID'], true );
/**
* 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/trash_field', $field );
// Return true.
return true;
}