diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index f28acc8d15..9effbadcd5 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -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 ) { diff --git a/tests/phpunit/tests/theme/support.php b/tests/phpunit/tests/theme/support.php index e0cab13289..a6bdf5efac 100644 --- a/tests/phpunit/tests/theme/support.php +++ b/tests/phpunit/tests/theme/support.php @@ -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 */