WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp update comment

Contents

Description

Updates an existing comment in the database.

Filters the comment and makes sure certain fields are valid before updating.

Usage

<?php wp_update_comment$commentarr ?>

Parameters

$commentarr
(array) (required) Contains information on the comment. See get_comment() for a list of valid attributes.
Default: None

Return Values

(integer) 
Comment was updated if value is 1, or was not updated if value is 0.

Examples

Unapproving a comment

<?php
$commentarr = array();
$commentarr['comment_ID'] = 123; // This is the only required array key
$commentarr['comment_approved'] = 0;
wp_update_comment( $commentarr );
?>

Notes

Change Log

Since: 2.0.0

Source File

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

Related

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