Short-circuits updating metadata of a specific type.
Description
The dynamic portion of the hook name, $meta_type, refers to the meta object type (post, comment, term, user, or any other type with an associated meta table).Returning a non-null value will effectively short-circuit the function. Possible hook names include: <ul> <li>update_post_metadata</li> <li>update_comment_metadata</li> <li>update_term_metadata</li> <li>update_user_metadata</li> </ul>
Parameters
$checknull|bool
Whether to allow updating metadata for the given type.
$object_idint
ID of the object metadata is for.
$meta_keystring
Metadata key.
$meta_valuemixed
Metadata value. Must be serializable if non-scalar.
$prev_valuemixed
Previous value to check before updating. If specified, only update existing metadata entries with this value. Otherwise, update all entries.
235* @param string$meta_key Metadata key.236* @param mixed$meta_value Metadata value. Must be serializable if non-scalar.237* @param mixed$prev_value Optional. Previous value to check before updating.238*If specified, only update existing metadata entries with239* this value. Otherwise, update all entries.240*/241$check=apply_filters("update_{$meta_type}_metadata",null,$object_id,$meta_key,$meta_value,$prev_value);242if(null!==$check){243return(bool)$check;244}245246// Compare existing value to new value if no prev value given and the key exists only once.247if(empty($prev_value)){
History
Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.