Action hook 'trashed_post_comments'

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

View Source

trashed_post_comments

Action Hook
Description
Fires after comments are sent to the Trash.

Hook Information

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

Hook Parameters

Type Name Description
int $post_id Post ID.
array $statuses Array of comment statuses.

Usage Examples

Basic Usage
<?php
// Hook into trashed_post_comments
add_action('trashed_post_comments', 'my_custom_function', 10, 2);

function my_custom_function($post_id, $statuses) {
    // Your custom code here
}

Source Code Context

wp-includes/post.php:4164 - How this hook is used in WordPress core
<?php
4159  	 * @since 2.9.0
4160  	 *
4161  	 * @param int   $post_id  Post ID.
4162  	 * @param array $statuses Array of comment statuses.
4163  	 */
4164  	do_action( 'trashed_post_comments', $post_id, $statuses );
4165  
4166  	return $result;
4167  }
4168  
4169  /**

PHP Documentation

<?php
/**
	 * Fires after comments are sent to the Trash.
	 *
	 * @since 2.9.0
	 *
	 * @param int   $post_id  Post ID.
	 * @param array $statuses Array of comment statuses.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.