Filter hook 'pre_untrash_post'

in WP Core File wp-includes/post.php at line 4043

View Source

pre_untrash_post

Filter Hook
Description
Filters whether a post untrashing should take place.

Hook Information

File Location wp-includes/post.php View on GitHub
Hook Type Filter
Line Number 4043

Hook Parameters

Type Name Description
bool|null $untrash Whether to go forward with untrashing.
WP_Post $post Post object.
string $previous_status The status of the post at the point where it was trashed.

Usage Examples

Basic Usage
<?php
// Hook into pre_untrash_post
add_filter('pre_untrash_post', 'my_custom_filter', 10, 3);

function my_custom_filter($untrash, $post, $previous_status) {
    // Your custom filtering logic here
    return $untrash;
}

Source Code Context

wp-includes/post.php:4043 - How this hook is used in WordPress core
<?php
4038  	 *
4039  	 * @param bool|null $untrash         Whether to go forward with untrashing.
4040  	 * @param WP_Post   $post            Post object.
4041  	 * @param string    $previous_status The status of the post at the point where it was trashed.
4042  	 */
4043  	$check = apply_filters( 'pre_untrash_post', null, $post, $previous_status );
4044  	if ( null !== $check ) {
4045  		return $check;
4046  	}
4047  
4048  	/**

PHP Documentation

<?php
/**
	 * Filters whether a post untrashing should take place.
	 *
	 * @since 4.9.0
	 * @since 5.6.0 Added the `$previous_status` parameter.
	 *
	 * @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.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.