pre_delete_post
Filter HookDescription
Filters whether a post deletion should take place.Hook Information
File Location |
wp-includes/post.php
View on GitHub
|
Hook Type | Filter |
Line Number | 3737 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_Post|false|null
|
$delete
|
Whether to go forward with deletion. |
WP_Post
|
$post
|
Post object. |
bool
|
$force_delete
|
Whether to bypass the Trash. |
Usage Examples
Basic Usage
<?php
// Hook into pre_delete_post
add_filter('pre_delete_post', 'my_custom_filter', 10, 3);
function my_custom_filter($delete, $post, $force_delete) {
// Your custom filtering logic here
return $delete;
}
Source Code Context
wp-includes/post.php:3737
- How this hook is used in WordPress core
<?php
3732 *
3733 * @param WP_Post|false|null $delete Whether to go forward with deletion.
3734 * @param WP_Post $post Post object.
3735 * @param bool $force_delete Whether to bypass the Trash.
3736 */
3737 $check = apply_filters( 'pre_delete_post', null, $post, $force_delete );
3738 if ( null !== $check ) {
3739 return $check;
3740 }
3741
3742 /**
PHP Documentation
<?php
/**
* Filters whether a post deletion should take place.
*
* @since 4.4.0
*
* @param WP_Post|false|null $delete Whether to go forward with deletion.
* @param WP_Post $post Post object.
* @param bool $force_delete Whether to bypass the Trash.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/post.php
Related Hooks
Related hooks will be displayed here in future updates.