sanitize_(object_type)_meta_(meta_key) filter-hookWP 3.3.0

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

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

Usage

add_filter( 'sanitize_(object_type)_meta_(meta_key)', 'wp_kama_sanitize_object_type_meta_key_filter', 10, 3 );

/**
 * Function for `sanitize_(object_type)_meta_(meta_key)` 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.
 *
 * @return mixed
 */
function wp_kama_sanitize_object_type_meta_key_filter( $meta_value, $meta_key, $object_type ){

	// 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.

Changelog

Since 3.3.0 Introduced.

Where the hook is called

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

Where the hook is used in WordPress

wp-includes/blocks.php 2595
add_filter( 'sanitize_post_meta_footnotes', '_wp_filter_post_meta_footnotes' );
wp-includes/blocks.php 2605
remove_filter( 'sanitize_post_meta_footnotes', '_wp_filter_post_meta_footnotes' );
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 1493
add_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'], 10, 3 );
wp-includes/meta.php 1636
remove_filter( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['sanitize_callback'] );
wp-includes/meta.php 1638
remove_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'] );