[wp-trac] [WordPress Trac] #58433: WP version in Etag header in load-styles.php file

WordPress Trac noreply at wordpress.org
Mon Jun 19 00:44:34 UTC 2023


#58433: WP version in Etag header in load-styles.php file
-------------------------------------------------+-------------------------
 Reporter:  dav4                                 |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  General                              |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing has-         |     Focuses:
  testing-info has-screenshots                   |
-------------------------------------------------+-------------------------

Comment (by peterwilsoncc):

 Replying to [comment:15 azaozz]:
 > The way this has been working in alpha/beta (for WP development) is by
 appending a timestamp to `$wp_version` every time WP is built, see
 https://core.trac.wordpress.org/browser/tags/6.2.2/Gruntfile.js#L414.

 It looks like this only works if running WordPress-Develop from the
 `build` directory. As most people work in the `src` directory (anecdotal
 but `src` is the default in WordPress-Develop's Docker environment) the
 cache remains unbroken.

 Thus the etag doesn't change when the editor packages are updated which
 can cause the caching issues I've seen.

 It may be worth adding something like this in `version.php` but it's
 probably best done on another ticket:

 {{{#!php
 <?php
 /*
  * When running from the source directory of the WordPress-Develop repo,
 the
  * WordPress version needs to be modified for the purpose of cache-busting
  * JavaScript and CSS files. The following code will modify the version
 number
  * to include the current timestamp if the version number is not a
 release.
  */
 if ( preg_match( '/-.*-\d{5,}-src$/', $wp_version ) ) {
         $wp_version = substr_replace( $wp_version, (string) time(), -3 );
 }
 }}}

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


More information about the wp-trac mailing list