Function: delete_post_meta

delete_post_meta( integer $post_id, string $meta_key, mixed $meta_value )

Deletes a post meta field for the given post ID.

Shortcut: dpm

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.

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 the key, if needed.


Name Type(s) Default Value Description
$post_id integer

Post ID.

$meta_key string

Metadata name.

$meta_value mixed ''

Optional. Metadata value. Must be serializable if non-scalar. Default empty.



True on success, false on failure.

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.