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 );
}

Changelog

Version Description
2.3.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/delete_post_meta_by_key