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
This commit is contained in:
Felix Arntz 2018-08-28 13:37:26 +00:00
parent aa5b179247
commit b0c83c8ee7
1 changed files with 6 additions and 2 deletions

View File

@ -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 = '';