From b0c83c8ee7d1310219412cdd9d7a63c1459d9ff0 Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Tue, 28 Aug 2018 13:37:26 +0000 Subject: [PATCH] General: Provide context parameters to `doing_it_wrong_trigger_error` filter. `$function`, `$message`, and `$version` have historically been passed to the `doing_it_wrong_run` action. It makes sense to pass those to the filter as well, so that one can conditionally determine the filter value to return. Fixes #34183. git-svn-id: https://develop.svn.wordpress.org/trunk@43587 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 3efc93a450..16032f465a 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -4358,10 +4358,14 @@ function _doing_it_wrong( $function, $message, $version ) { * Filters whether to trigger an error for _doing_it_wrong() calls. * * @since 3.1.0 + * @since 5.0.0 Added the $function, $message and $version parameters. * - * @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true. + * @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true. + * @param string $function 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. */ - if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) { + if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true, $function, $message, $version ) ) { if ( function_exists( '__' ) ) { if ( is_null( $version ) ) { $version = '';