Plugins: Return the original value in `apply_filters_deprecated()` if no filter is registered for the tag.

Props flixos90.
Fixes #10441.

git-svn-id: https://develop.svn.wordpress.org/trunk@37911 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2016-06-29 13:21:24 +00:00
parent a985e346b1
commit a89fdc3935
2 changed files with 10 additions and 1 deletions

View File

@ -674,7 +674,7 @@ function remove_all_actions($tag, $priority = false) {
*/
function apply_filters_deprecated( $tag, $args, $version, $replacement = false, $message = null ) {
if ( ! has_filter( $tag ) ) {
return;
return $args[0];
}
_deprecated_hook( $tag, $version, $replacement, $message );

View File

@ -359,4 +359,13 @@ class Tests_Filters extends WP_UnitTestCase {
return $p1;
}
/**
* @ticket 10441
*/
public function test_apply_filters_deprecated_without_filter() {
$val = 'Foobar';
$this->assertSame( $val, apply_filters_deprecated( 'tests_apply_filters_deprecated', array( $val ), '4.6' ) );
}
}