On this page
delete_comment_meta( int $comment_id, string $meta_key, mixed $meta_value = '' ): bool
Removes metadata matching criteria from a comment.
Description
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.
Parameters
$comment_idint Required-
Comment ID.
$meta_keystring Required-
Metadata name.
$meta_valuemixed Optional-
Metadata value. If provided, rows will only be removed that match the value.
Must be serializable if non-scalar.Default:
''
Return
bool True on success, false on failure.
Source
File: wp-includes/comment.php. View all references
function delete_comment_meta( $comment_id, $meta_key, $meta_value = '' ) {
return delete_metadata( 'comment', $comment_id, $meta_key, $meta_value );
}
Related
Uses
| Uses | Description |
|---|---|
| delete_metadata() wp-includes/meta.php | Deletes metadata for the specified object. |
Used By
| Used By | Description |
|---|---|
| wp_scheduled_delete() wp-includes/functions.php | Permanently deletes comments or posts of any type that have held a status of ‘trash’ for the number of days defined in EMPTY_TRASH_DAYS. |
| wp_spam_comment() wp-includes/comment.php | Marks a comment as Spam. |
| wp_unspam_comment() wp-includes/comment.php | Removes a comment from the Spam. |
| wp_trash_comment() wp-includes/comment.php | Moves a comment to the Trash |
| wp_untrash_comment() wp-includes/comment.php | Removes a comment from the Trash |
Changelog
| Version | Description |
|---|---|
| 2.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/delete_comment_meta