delete_post_meta_by_key() WordPress Function
The delete_post_meta_by_key() function allows you to delete post meta data by its key. This is useful for when you want to remove specific data from a post, rather than all post meta data.
delete_post_meta_by_key( string $post_meta_key ) #
Deletes everything from post meta matching the given meta key.
Parameters
- $post_meta_key
(string)(Required)Key to search for when deleting.
Return
(bool) Whether the post meta key was deleted from the database.
Source
File: wp-includes/post.php
function delete_post_meta_by_key( $post_meta_key ) { return delete_metadata( 'post', null, $post_meta_key, '', true ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.3.0 | Introduced. |