[wp-trac] [WordPress Trac] #64762: Frontend admin toolbar not using updated admin color scheme

WordPress Trac noreply at wordpress.org
Sat Mar 14 20:42:26 UTC 2026


#64762: Frontend admin toolbar not using updated admin color scheme
-------------------------------------------------+-------------------------
 Reporter:  huzaifaalmesbah                      |       Owner:  audrasjb
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  7.0
Component:  Toolbar                              |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  has-screenshots admin-reskin has-    |     Focuses:  ui, css
  patch has-unit-tests changes-requested         |
-------------------------------------------------+-------------------------

Comment (by westonruter):

 Ah, yes. I see that. In that case, better to just do the `strpos( $css,
 '#wpadminbar' )` check instead of `str_contains( $css, '#wpadminbar' )`.

 I was working on that, but then I found a more significant issue with the
 implementation: it was doing an HTTP request to obtain the color scheme
 CSS for every frontend page load. This resulted in the logic not working
 in the default Docker development environment where loopback requests are
 unfortunately broken (at least for me anyway), but it also is a
 performance problem. Query Monitor warns about this with each page load.

 I've taken a stab in [https://github.com/WordPress/wordpress-
 develop/pull/11255 this PR] to refactor the logic to not rely on HTTP
 requests but to load the file from the filesystem instead. Additionally,
 I've split the single test into two, one for the frontend and the other
 for the backend.

 I admit I'm not fully familiar with the existing assertions or what the
 logic in `wp_admin_bar_add_color_scheme_to_front_end()` is supposed to be
 doing. I tried adding assertions to test that the existing logic is
 working as expected. I'm not sure what this assertion was supposed to be
 checking for originally:

 {{{#!php
 <?php
 $this->assertFalse( wp_style_loader_src( '', 'colors' ) )
 }}}

 Or what this was asserting with r62025:

 {{{#!php
 <?php
 $this->assertStringContainsString( '/colors.css', wp_style_loader_src( '',
 'colors' ) );
 }}}


 The tests may fail, however, in GHA due to the files not being built. So
 the test may need to write a sample `colors.css` for test purposes,
 similar to how we have to touch files in other unit tests.

 @sabernhardt I'll invite you to my fork so you can push up additional
 commits.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64762#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list