delete_comment_metadata хук-фильтрWP 3.1.0

Short-circuits deleting metadata of a specific type.

Это один из вариантов динамического хука delete_(meta_type)_metadata

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

add_filter( 'delete_comment_metadata', 'wp_kama_delete_comment_metadata_filter', 10, 5 );

/**
 * Function for `delete_comment_metadata` filter-hook.
 * 
 * @param null|bool $delete     Whether to allow metadata deletion of 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 bool      $delete_all Whether to delete the matching metadata entries for all objects, ignoring the specified $object_id.
 *
 * @return null|bool
 */
function wp_kama_delete_comment_metadata_filter( $delete, $object_id, $meta_key, $meta_value, $delete_all ){

	// filter...
	return $delete;
}
$delete(null|true|false)
Whether to allow metadata deletion of the given type.
$object_id(int)
ID of the object metadata is for.
$meta_key(строка)
Metadata key.
$meta_value(разное)
Metadata value. Must be serializable if non-scalar.
$delete_all(true|false)
Whether to delete the matching metadata entries for all objects, ignoring the specified $object_id.
По умолчанию: false

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

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

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

delete_metadata()
delete_comment_metadata
wp-includes/meta.php 425
$check = apply_filters( "delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all );

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

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