On this page
update_meta( int $meta_id, string $meta_key, string $meta_value ): bool
Updates post meta data by meta ID.
Parameters
$meta_idint Required-
Meta ID.
$meta_keystring Required-
Meta key. Expect slashed.
$meta_valuestring Required-
Meta value. Expect slashed.
Return
bool
Source
File: wp-admin/includes/post.php. View all references
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 );
}
Related
Uses
| Uses | Description |
|---|---|
| update_metadata_by_mid() wp-includes/meta.php | Updates metadata by meta ID. |
| wp_unslash() wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
Used By
| Used By | Description |
|---|---|
| edit_post() wp-admin/includes/post.php | Updates an existing post with values provided in |
Changelog
| Version | Description |
|---|---|
| 1.2.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/update_meta