update_metadata


update_metadata ( $meta_type, $object_id, $meta_key, $meta_value, $prev_value = '' )

Parameters:
  • (string) $meta_type Type of object metadata is for (e.g., comment, post, term, or user).
  • (int) $object_id ID of the object metadata is for
  • (string) $meta_key Metadata key
  • (mixed) $meta_value Metadata value. Must be serializable if non-scalar.
  • (mixed) $prev_value Optional. If specified, only update existing metadata entries with the specified value. Otherwise, update all entries.
Returns:
  • (int|bool) The new meta field ID if a field with the given key didn't exist and was therefore added, true on successful update, false on failure.
Defined at:

Description

Update metadata for the specified object. If no value already exists for the specified object ID and metadata key, the metadata will be added.

Related Functions

update_meta, update_metadata_by_mid, delete_metadata, update_meta_cache, get_metadata

Top Google Results

User discussions

wpseek mobile