ACF_Internal_Post_Type::trash_post
Trashes an ACF post.
Метод класса: ACF_Internal_Post_Type{}
Хуки из метода
Возвращает
true|false.
Использование
$ACF_Internal_Post_Type = new ACF_Internal_Post_Type(); $ACF_Internal_Post_Type->trash_post( $id );
- $id(int|строка)
- The ID of the ACF post to trash.
Список изменений
| С версии 6.1 | Введена. |
Код ACF_Internal_Post_Type::trash_post() ACF Internal Post Type::trash post ACF 6.4.2
public function trash_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_trash_post( $post['ID'] );
$this->flush_post_cache( $post );
/**
* Fires immediately after a field_group has been trashed.
*
* @date 12/02/2014
* @since 5.0.0
*
* @param array $post The ACF post array.
*/
do_action( "acf/trash_{$this->hook_name}", $post );
return true;
}