Filter hook 'deprecated_constructor_trigger_error'

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

View Source

deprecated_constructor_trigger_error

Filter Hook
Description
Filters whether to trigger an error for deprecated functions. `WP_DEBUG` must be true in addition to the filter evaluating to true.

Hook Information

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

Hook Parameters

Type Name Description
bool $trigger Whether to trigger the error for deprecated functions. Default true.

Usage Examples

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

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

Source Code Context

wp-includes/functions.php:5633 - How this hook is used in WordPress core
<?php
5628  	 *
5629  	 * @since 4.3.0
5630  	 *
5631  	 * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
5632  	 */
5633  	if ( WP_DEBUG && apply_filters( 'deprecated_constructor_trigger_error', true ) ) {
5634  		if ( function_exists( '__' ) ) {
5635  			if ( $parent_class ) {
5636  				$message = sprintf(
5637  					/* translators: 1: PHP class name, 2: PHP parent class name, 3: Version number, 4: __construct() method. */
5638  					__( 'The called constructor method for %1$s class in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.' ),

PHP Documentation

<?php
/**
	 * Filters whether to trigger an error for deprecated functions.
	 *
	 * `WP_DEBUG` must be true in addition to the filter evaluating to true.
	 *
	 * @since 4.3.0
	 *
	 * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/functions.php
Related Hooks

Related hooks will be displayed here in future updates.