delete_comment
Fires immediately before a comment is deleted from the database.
Usage
add_action( 'delete_comment', 'wp_kama_delete_comment_action', 10, 2 );
/**
* Function for `delete_comment` action-hook.
*
* @param string $comment_id The comment ID as a numeric string.
* @param WP_Comment $comment The comment to be deleted.
*
* @return void
*/
function wp_kama_delete_comment_action( $comment_id, $comment ){
// action...
}
- $comment_id(string)
- The comment ID as a numeric string.
- $comment(WP_Comment)
- The comment to be deleted.
Changelog
| Since 1.2.0 | Introduced. |
| Since 4.9.0 | Added the $comment parameter. |
Where the hook is called
wp-includes/comment.php 1526
do_action( 'delete_comment', $comment->comment_ID, $comment );