delete_comment_meta

Remove metadata matching criteria from a comment.

Description

delete_comment_meta( (int) $comment_id, (string) $meta_key, (string) $meta_value = '' ); 

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

  1. if ( !function_exists( 'delete_comment_meta' ) ) { 
  2. require_once ABSPATH . WPINC . '/comment.php'; 
  3.  
  4. // The comment id. 
  5. $comment_id = -1; 
  6.  
  7. // Metadata name. 
  8. $meta_key = ''; 
  9.  
  10. // Optional. Metadata value. 
  11. $meta_value = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = delete_comment_meta($comment_id, $meta_key, $meta_value); 
  15.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/comment.php  
  1. function delete_comment_meta($comment_id, $meta_key, $meta_value = '') { 
  2. return delete_metadata('comment', $comment_id, $meta_key, $meta_value);