pre_trash_post
Filters whether a post trashing should take place.
Использование
add_filter( 'pre_trash_post', 'wp_kama_pre_trash_post_filter', 10, 2 ); /** * Function for `pre_trash_post` filter-hook. * * @param bool|null $trash Whether to go forward with trashing. * @param WP_Post $post Post object. * * @return bool|null */ function wp_kama_pre_trash_post_filter( $trash, $post ){ // filter... return $trash; }
- $trash(true|false|null)
- Whether to go forward with trashing.
- $post(WP_Post)
- Post object.
Список изменений
С версии 4.9.0 | Введена. |
Где вызывается хук
pre_trash_post
wp-includes/post.php 3570
$check = apply_filters( 'pre_trash_post', null, $post );
wp-includes/class-wp-customize-manager.php 3079
$check = apply_filters( 'pre_trash_post', null, $post );