update_post_metadata filter-hookWP 3.1.0

Short-circuits updating metadata of a specific type.

This is one of the variants of the dynamic hook update_(meta_type)_metadata

Usage

add_filter( 'update_post_metadata', 'wp_kama_update_post_metadata_filter', 10, 5 );

/**
 * Function for `update_post_metadata` filter-hook.
 * 
 * @param null|bool $check      Whether to allow updating metadata for the given type.
 * @param int       $object_id  ID of the object metadata is for.
 * @param string    $meta_key   Metadata key.
 * @param mixed     $meta_value Metadata value. Must be serializable if non-scalar.
 * @param mixed     $prev_value Optional. Previous value to check before updating. If specified, only update existing metadata entries with this value. Otherwise, update all entries.
 *
 * @return null|bool
 */
function wp_kama_update_post_metadata_filter( $check, $object_id, $meta_key, $meta_value, $prev_value ){

	// filter...
	return $check;
}
$check(null|true|false)
Whether to allow updating metadata for the given type.
$object_id(int)
ID of the object metadata is for.
$meta_key(string)
Metadata key.
$meta_value(mixed)
Metadata value. Must be serializable if non-scalar.
$prev_value(mixed)
Optional. Previous value to check before updating. If specified, only update existing metadata entries with this value. Otherwise, update all entries.

Changelog

Since 3.1.0 Introduced.

Where the hook is called

update_metadata()
update_post_metadata
wp-includes/meta.php 235
$check = apply_filters( "update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value );

Where the hook is used in WordPress

Usage not found.