sanitize_(object_type)_meta_(meta_key)_for_(object_subtype) хук-фильтрWP 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.

Использование

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(разное)
Metadata value to sanitize.
$meta_key(строка)
Metadata key.
$object_type(строка)
Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.
$object_subtype(строка)
Object subtype.

Список изменений

С версии 4.9.8 Введена.

Где вызывается хук

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

Где используется хук в WordPress

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