A WordPress-centric search engine for devs and theme authors



delete_post_meta_by_key ›

Since2.3.0
Deprecatedn/a
delete_post_meta_by_key ( $post_meta_key )
Parameters:
  • (string) $post_meta_key Key to search for when deleting.
    Required: Yes
Returns:
  • (bool) Whether the post meta key was deleted from the database.
Defined at:
Codex:

Deletes everything from post meta matching the given meta key.



Source

function delete_post_meta_by_key( $post_meta_key ) {
	$deleted = delete_metadata( 'post', null, $post_meta_key, '', true );
	if ( $deleted ) {
		wp_cache_set( 'last_changed', microtime(), 'posts' );
	}
	return $deleted;
}