mirror of
git://develop.git.wordpress.org/
synced 2025-02-12 02:44:22 +01:00
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:
parent
a985e346b1
commit
a89fdc3935
@ -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 );
|
||||
|
@ -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' ) );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user