WPDev.one
Core Function
View Source on Trac ↗

update_term_meta()

update_term_meta( mixed $term_id, mixed $meta_key, mixed $meta_value, mixed $prev_value = '' )

Updates term metadata.

Parameters 4 required

Name / Type Description
$term_id
int

Term ID.

Required
$meta_key
string

Metadata key.

Required
$meta_value
mixed

Metadata value. Must be serializable if non-scalar.

Required
mixed

$prev_value Optional. Previous value to check before updating. If specified, only update existing metadata entries with this value. Otherwise, update all entries. Default empty.

Required

Return Value

((int)
(int | bool | WP_Error) Meta ID if the key didn't exist. true on successful update, false on failure or if the value passed to the function is the same as the one that is already in the database. WP_Error when term_id is ambiguous between taxonomies.

Function Information

Since Version
4.4.0
Source File
wp-includes/taxonomy.php
Advertisement