pre_untrash_post
Filters whether a post untrashing should take place.
Использование
add_filter( 'pre_untrash_post', 'wp_kama_pre_untrash_post_filter', 10, 3 ); /** * Function for `pre_untrash_post` filter-hook. * * @param bool|null $untrash Whether to go forward with untrashing. * @param WP_Post $post Post object. * @param string $previous_status The status of the post at the point where it was trashed. * * @return bool|null */ function wp_kama_pre_untrash_post_filter( $untrash, $post, $previous_status ){ // filter... return $untrash; }
- $untrash(true|false|null)
- Whether to go forward with untrashing.
- $post(WP_Post)
- Post object.
- $previous_status(строка)
- The status of the post at the point where it was trashed.
Список изменений
С версии 4.9.0 | Введена. |
С версии 5.6.0 | Added the $previous_status parameter. |
Где вызывается хук
wp-includes/post.php 3761
$check = apply_filters( 'pre_untrash_post', null, $post, $previous_status );