delete_comment

delete_comment

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: action
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.4.3

do_action('delete_comment') is found 2 times:

  • /wp-content/plugins/akismet/class.akismet.php line 515
     
    			foreach ( $comment_ids as $comment_id ) {
    				$comments[ $comment_id ] = get_comment( $comment_id );
    
    				do_action( 'delete_comment', $comment_id, $comments[ $comment_id ] );
    				do_action( 'akismet_batch_delete_count', __FUNCTION__ );
    			}
    
    			// Prepared as strings since comment_id is an unsigned BIGINT, and using %d will constrain the value to the maximum signed BIGINT.
    			$format_string = implode( ', ', array_fill( 0, is_countable( $comment_ids ) ? count( $comment_ids ) : 0, '%s' ) );
    
    
  • /wp-includes/comment.php line 1470
    	 *
    	 * @param string     $comment_id The comment ID as a numeric string.
    	 * @param WP_Comment $comment    The comment to be deleted.
    	 */
    	do_action( 'delete_comment', $comment->comment_ID, $comment );
    
    	// Move children up a level.
    	$children = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_parent = %d", $comment->comment_ID ) );
    	if ( ! empty( $children ) ) {
    		$wpdb->update( $wpdb->comments, array( 'comment_parent' => $comment->comment_parent ), array( 'comment_parent' => $comment->comment_ID ) );
    		clean_comment_cache( $children );
    

See this hook used in plugins: