sanitize_(object_type)_meta_(meta_key)_for_(object_subtype) filter-hookWP 4.9.8

Filters the sanitization of a specific meta key of a specific meta type and subtype.

The dynamic portions of the hook name, $object_type, $meta_key, and $object_subtype, refer to the metadata object type (comment, post, term, or user), the meta key value, and the object subtype respectively.

Usage

add_filter( 'sanitize_(object_type)_meta_(meta_key)_for_(object_subtype)', 'wp_kama_sanitize_object_type_meta_key_for_subtype_filter', 10, 4 );

/**
 * Function for `sanitize_(object_type)_meta_(meta_key)_for_(object_subtype)` filter-hook.
 * 
 * @param mixed  $meta_value     Metadata value to sanitize.
 * @param string $meta_key       Metadata key.
 * @param string $object_type    Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.
 * @param string $object_subtype Object subtype.
 *
 * @return mixed
 */
function wp_kama_sanitize_object_type_meta_key_for_subtype_filter( $meta_value, $meta_key, $object_type, $object_subtype ){

	// filter...
	return $meta_value;
}
$meta_value(mixed)
Metadata value to sanitize.
$meta_key(string)
Metadata key.
$object_type(string)
Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.
$object_subtype(string)
Object subtype.

Changelog

Since 4.9.8 Introduced.

Where the hook is called

sanitize_meta()
sanitize_(object_type)_meta_(meta_key)_for_(object_subtype)
wp-includes/meta.php 1333
return apply_filters( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $meta_value, $meta_key, $object_type, $object_subtype );

Where the hook is used in WordPress

wp-includes/meta.php 1491
add_filter( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['sanitize_callback'], 10, 4 );
wp-includes/meta.php 1636
remove_filter( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['sanitize_callback'] );