update_term_meta

Advertisement

Summery Summery

Updates term metadata.

Syntax Syntax

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

Description Description

Use the $prev_value parameter to differentiate between meta fields with the same key and term ID.

If the meta field for the term does not exist, it will be added.

Parameters Parameters

$term_id

(int) (Required) Term ID.

$meta_key

(string) (Required) Metadata key.

$meta_value

(mixed) (Required) Metadata value.

$prev_value

(mixed) (Optional) Previous value to check before removing.

Default value: ''

Return Return

(int|WP_Error|bool) Meta ID if the key didn't previously exist. True on successful update. WP_Error when term_id is ambiguous between taxonomies. False on failure.

Source Source

File: wp-includes/taxonomy.php

 * @param string $meta_key   Metadata name.
 * @param mixed  $meta_value Optional. Metadata value. If provided,
 *                           rows will only be removed that match the value.
 *                           Must be serializable if non-scalar. Default empty.
 * @return bool True on success, false on failure.
 */
function delete_term_meta( $term_id, $meta_key, $meta_value = '' ) {

Advertisement

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.