Themes: Add version to theme screenshot URL for better browser cache handling.

This change appends the theme version number to the URL of screenshots that appear in various place of the WordPress Admin. As a result, browsers will be able to refresh the screenshot as needed when the theme is updated.

Props codente, desrosj, audrasjb, SergeyBiryukov.
Fixes #53370.



git-svn-id: https://develop.svn.wordpress.org/trunk@52947 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jb Audras
2022-03-17 22:19:58 +00:00
parent 06729f665f
commit 0fb4f90030
6 changed files with 10 additions and 10 deletions

View File

@@ -282,7 +282,7 @@ if ( $tab ) {
<script id="tmpl-theme" type="text/template">
<# if ( data.screenshot_url ) { #>
<div class="theme-screenshot">
<img src="{{ data.screenshot_url }}" alt="" />
<img src="{{ data.screenshot_url }}?ver={{ data.version }}" alt="" />
</div>
<# } else { #>
<div class="theme-screenshot blank"></div>
@@ -456,7 +456,7 @@ if ( $tab ) {
?>
</span>
<img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="" />
<img class="theme-screenshot" src="{{ data.screenshot_url }}?ver={{ data.version }}" alt="" />
<div class="theme-details">
<# if ( data.rating ) { #>