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

Function Reference/delete comment meta


Remove metadata matching criteria from a comment. You can match based on the key, or key and value. Removing based on key and value will keep from removing duplicate metadata with the same key. It also allows removing all metadata matching key, if needed.

delete_comment_meta() allows you to delete any meta values stored against comments, which have been set using add_comment_meta(). Similar method to delete_post_meta().


<?php delete_comment_meta$comment_id$meta_key$meta_value ); ?>


(integer) (required) Comment ID
Default: None
(string) (required) Metadata key
Default: None
(mixed) (optional) Metadata value
Default: Empty string

Return Values

False for failure. True for success.



// Delete all metadata with the key 'my_meta_key' for comment ID 5.
delete_comment_meta( 5, 'my_meta_key' );

// Delete metadata for 'my_meta_key' only where the meta_value is 'foo'.
delete_comment_meta( 5, 'my_meta_key', 'foo' );



Change Log

Since: 2.9.0

Source File

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


Comment Meta Functions: add_comment_meta(), get_comment_meta(), update_comment_meta(), delete_comment_meta()

This article is marked as in need of editing. You can help Codex by editing it.