delete_post_meta_by_key

Delete everything from post meta matching meta key.

Description

delete_post_meta_by_key( (string) $post_meta_key ); 

Parameters (1)

0. $post_meta_key (string)
Key to search for when deleting.

Usage

  1. if ( !function_exists( 'delete_post_meta_by_key' ) ) { 
  2. require_once ABSPATH . WPINC . '/post.php'; 
  3.  
  4. // Key to search for when deleting. 
  5. $post_meta_key = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = delete_post_meta_by_key($post_meta_key); 
  9.  

Defined (1)

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

/wp-includes/post.php  
  1. function delete_post_meta_by_key( $post_meta_key ) { 
  2. return delete_metadata( 'post', null, $post_meta_key, '', true );