From 51124eea0411e372e8dd170e77a4379c443425d0 Mon Sep 17 00:00:00 2001 From: Pierre Gordon Date: Mon, 15 Jun 2020 22:48:15 -0400 Subject: [PATCH] Prevent printing styles for Site Health on every admin page --- src/Admin/SiteHealth.php | 2 +- tests/php/test-class-site-health.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Admin/SiteHealth.php b/src/Admin/SiteHealth.php index 987ec3076d6..105ace0cf99 100644 --- a/src/Admin/SiteHealth.php +++ b/src/Admin/SiteHealth.php @@ -29,7 +29,7 @@ public function init() { add_filter( 'site_status_tests', [ $this, 'add_tests' ] ); add_filter( 'debug_information', [ $this, 'add_debug_information' ] ); add_filter( 'site_status_test_php_modules', [ $this, 'add_extensions' ] ); - add_action( 'admin_print_styles', [ $this, 'add_styles' ] ); + add_action( 'admin_print_styles-site-health.php', [ $this, 'add_styles' ] ); ( new ReenableCssTransientCachingAjaxAction() )->register(); } diff --git a/tests/php/test-class-site-health.php b/tests/php/test-class-site-health.php index 4e79b234ed0..439f5264abd 100644 --- a/tests/php/test-class-site-health.php +++ b/tests/php/test-class-site-health.php @@ -55,6 +55,7 @@ public function test_init() { $this->assertEquals( 10, has_action( 'site_status_tests', [ $this->instance, 'add_tests' ] ) ); $this->assertEquals( 10, has_action( 'debug_information', [ $this->instance, 'add_debug_information' ] ) ); $this->assertEquals( 10, has_action( 'site_status_test_php_modules', [ $this->instance, 'add_extensions' ] ) ); + $this->assertEquals( 10, has_action( 'admin_print_styles-site-health.php', [ $this->instance, 'add_styles' ] ) ); } /**