WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/wp delete comment

Contents

Description

Trashes or deletes a comment.

The comment is moved to trash instead of permanently deleted unless trash is disabled, item is already in the trash, or $force_delete is true.

The post comment count will be updated if the comment was approved and has a post ID available.

Usage

<?php wp_delete_comment$comment_id$force_delete ?>

Parameters

$comment_id
(integer) (required) Comment ID
Default: None
$force_delete
(boolean) (optional) Move comment to trash or delete.
Default: false

Return Values

(boolean) 
False if delete comment query failure, true on success.

Examples

Notes

Change Log

Since: 2.0.0

Source File

wp_delete_comment() is located in wp-includes/comment.php.

Related

 

See also index of Function Reference and index of Template Tags.