W3cubDocs

/WordPress

update_meta( int $meta_id, string $meta_key, string $meta_value )

Update post meta data by meta ID.

Parameters

$meta_id

(int) (Required)

$meta_key

(string) (Required) Expect Slashed

$meta_value

(string) (Required) Expect Slashed

Return

(bool)

Source

File: wp-admin/includes/post.php

function update_meta( $meta_id, $meta_key, $meta_value ) {
	$meta_key   = wp_unslash( $meta_key );
	$meta_value = wp_unslash( $meta_value );

	return update_metadata_by_mid( 'post', $meta_id, $meta_value, $meta_key );
}

Changelog

Version Description
1.2.0 Introduced.

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