Filter hook 'doing_it_wrong_trigger_error'

in WP Core File wp-includes/functions.php at line 6023

View Source

doing_it_wrong_trigger_error

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

Hook Information

File Location wp-includes/functions.php View on GitHub
Hook Type Filter
Line Number 6023

Hook Parameters

Type Name Description
bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true.
string $function_name The function that was called.
string $message A message explaining what has been done incorrectly.
string $version The version of WordPress where the message was added.

Usage Examples

Basic Usage
<?php
// Hook into doing_it_wrong_trigger_error
add_filter('doing_it_wrong_trigger_error', 'my_custom_filter', 10, 4);

function my_custom_filter($trigger, $function_name, $message, $version) {
    // Your custom filtering logic here
    return $trigger;
}

Source Code Context

wp-includes/functions.php:6023 - How this hook is used in WordPress core
<?php
6018  	 * @param bool   $trigger       Whether to trigger the error for _doing_it_wrong() calls. Default true.
6019  	 * @param string $function_name The function that was called.
6020  	 * @param string $message       A message explaining what has been done incorrectly.
6021  	 * @param string $version       The version of WordPress where the message was added.
6022  	 */
6023  	if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true, $function_name, $message, $version ) ) {
6024  		if ( function_exists( '__' ) ) {
6025  			if ( $version ) {
6026  				/* translators: %s: Version number. */
6027  				$version = sprintf( __( '(This message was added in version %s.)' ), $version );
6028  			}

PHP Documentation

<?php
/**
	 * Filters whether to trigger an error for _doing_it_wrong() calls.
	 *
	 * @since 3.1.0
	 * @since 5.1.0 Added the $function_name, $message and $version parameters.
	 *
	 * @param bool   $trigger       Whether to trigger the error for _doing_it_wrong() calls. Default true.
	 * @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.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 4
  • File: wp-includes/functions.php
Related Hooks

Related hooks will be displayed here in future updates.