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

Filters whether to trigger an error for _doing_it_wrong() calls.

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

add_filter( 'doing_it_wrong_trigger_error', 'wp_kama_doing_it_wrong_trigger_error_filter', 10, 4 );

/**
 * Function for `doing_it_wrong_trigger_error` filter-hook.
 * 
 * @param bool   $trigger       Whether to trigger the error for _doing_it_wrong() calls.
 * @param string $function_name The function that was called.
 * @param string $message       A message explaining what has been done incorrectly.
 * @param string $version       The version of WordPress where the message was added.
 *
 * @return bool
 */
function wp_kama_doing_it_wrong_trigger_error_filter( $trigger, $function_name, $message, $version ){

	// filter...
	return $trigger;
}
$trigger(true|false)
Whether to trigger the error for _doing_it_wrong() calls.
По умолчанию: true
$function_name(строка)
The function that was called.
$message(строка)
A message explaining what has been done incorrectly.
$version(строка)
The version of WordPress where the message was added.

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

С версии 3.1.0 Введена.
С версии 5.1.0 Added the $function_name, $message and $version parameters.

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

_doing_it_wrong()
doing_it_wrong_trigger_error
wp-includes/functions.php 5984
if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true, $function_name, $message, $version ) ) {

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

wp-includes/rest-api.php 219
add_filter( 'doing_it_wrong_trigger_error', '__return_false' );