mirror of
git://develop.git.wordpress.org/
synced 2025-03-22 04:49:49 +01:00
Themes: Make sure the current_theme_supports-{$feature}
filter is consistently applied.
Previously, the filter was not applied if there are no arguments passed to `current_theme_supports()`. Follow-up to [12350], [19682]. Props helgatheviking, azouamauriac, pavanpatil1, SergeyBiryukov. Fixes #55219. git-svn-id: https://develop.svn.wordpress.org/trunk@52812 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
44122bf7df
commit
f0dfa682a5
@ -3037,9 +3037,10 @@ function current_theme_supports( $feature, ...$args ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If no args passed then no extra checks need be performed.
|
||||
// If no args passed then no extra checks need to be performed.
|
||||
if ( ! $args ) {
|
||||
return true;
|
||||
/** This filter is documented in wp-includes/theme.php */
|
||||
return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[ $feature ] ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
|
||||
}
|
||||
|
||||
switch ( $feature ) {
|
||||
|
@ -167,6 +167,17 @@ class Tests_Theme_Support extends WP_UnitTestCase {
|
||||
$this->assertFalse( current_theme_supports( 'foobar', 'bar' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 55219
|
||||
*/
|
||||
public function test_plugin_hook_with_no_args() {
|
||||
add_theme_support( 'foobar' );
|
||||
|
||||
add_filter( 'current_theme_supports-foobar', '__return_false' );
|
||||
|
||||
$this->assertFalse( current_theme_supports( 'foobar' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 26900
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user