trashed_comment
Action HookDescription
Fires immediately after a comment is sent to Trash.Hook Information
File Location |
wp-includes/comment.php
View on GitHub
|
Hook Type | Action |
Line Number | 1611 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$comment_id
|
The comment ID as a numeric string. |
WP_Comment
|
$comment
|
The trashed comment. |
Usage Examples
Basic Usage
<?php
// Hook into trashed_comment
add_action('trashed_comment', 'my_custom_function', 10, 2);
function my_custom_function($comment_id, $comment) {
// Your custom code here
}
Source Code Context
wp-includes/comment.php:1611
- How this hook is used in WordPress core
<?php
1606 * @since 4.9.0 Added the `$comment` parameter.
1607 *
1608 * @param string $comment_id The comment ID as a numeric string.
1609 * @param WP_Comment $comment The trashed comment.
1610 */
1611 do_action( 'trashed_comment', $comment->comment_ID, $comment );
1612
1613 return true;
1614 }
1615
1616 return false;
PHP Documentation
<?php
/**
* Fires immediately after a comment is sent to Trash.
*
* @since 2.9.0
* @since 4.9.0 Added the `$comment` parameter.
*
* @param string $comment_id The comment ID as a numeric string.
* @param WP_Comment $comment The trashed comment.
*/
Quick Info
- Hook Type: Action
- Parameters: 2
- File: wp-includes/comment.php
Related Hooks
Related hooks will be displayed here in future updates.