Action hook 'delete_comment'

in WP Core File wp-content/plugins/akismet/class.akismet.php at line 575

View Source

delete_comment

Action Hook
Description
Determines how many days a comment will be left in the Spam queue before being deleted.

Hook Information

File Location wp-content/plugins/akismet/class.akismet.php View on GitHub
Hook Type Action
Line Number 575

Hook Parameters

This hook doesn't accept any parameters.

Usage Examples

Basic Usage
<?php
// Hook into delete_comment
add_action('delete_comment', 'my_custom_function');

function my_custom_function() {
    // Your custom code here
}

Source Code Context

wp-content/plugins/akismet/class.akismet.php:575 - How this hook is used in WordPress core
<?php
 570  			$comments = array();
 571  
 572  			foreach ( $comment_ids as $comment_id ) {
 573  				$comments[ $comment_id ] = get_comment( $comment_id );
 574  
 575  				do_action( 'delete_comment', $comment_id, $comments[ $comment_id ] );
 576  				do_action( 'akismet_batch_delete_count', __FUNCTION__ );
 577  			}
 578  
 579  			// Prepared as strings since comment_id is an unsigned BIGINT, and using %d will constrain the value to the maximum signed BIGINT.
 580  			$format_string = implode( ', ', array_fill( 0, is_countable( $comment_ids ) ? count( $comment_ids ) : 0, '%s' ) );

PHP Documentation

<?php
/**
		 * Determines how many days a comment will be left in the Spam queue before being deleted.
		 *
		 * @param int The default number of days.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 0
  • File: wp-content/plugins/akismet/class.akismet.php
Related Hooks

Related hooks will be displayed here in future updates.