delete_comment_meta
Remove 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 (3)
- 0. $comment_id (int)
- The comment id.
- 1. $meta_key (string)
- Metadata name.
- 2. $meta_value — Optional. (string) =>
''
- Metadata value.
Usage
if ( !function_exists( 'delete_comment_meta' ) ) { require_once ABSPATH . WPINC . '/comment.php'; } // The comment id. $comment_id = -1; // Metadata name. $meta_key = ''; // Optional. Metadata value. $meta_value = ''; // NOTICE! Understand what this does before running. $result = delete_comment_meta($comment_id, $meta_key, $meta_value);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/comment.php
- function delete_comment_meta($comment_id, $meta_key, $meta_value = '') {
- return delete_metadata('comment', $comment_id, $meta_key, $meta_value);
- }