Make WordPress Core


Ignore:
Timestamp:
03/17/2022 10:19:58 PM (2 years ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-theme-install-list-table.php

    r52204 r52947  
    360360        ?>
    361361        <a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>">
    362             <img src="<?php echo esc_url( $theme->screenshot_url ); ?>" width="150" alt="" />
     362            <img src="<?php echo esc_url( $theme->screenshot_url . '?ver=' . $theme->version ); ?>" width="150" alt="" />
    363363        </a>
    364364
     
    503503            </span>
    504504            <?php if ( isset( $theme->screenshot_url ) ) : ?>
    505                 <img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url ); ?>" alt="" />
     505                <img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url . '?ver=' . $theme->version ); ?>" alt="" />
    506506            <?php endif; ?>
    507507            <div class="theme-details">
Note: See TracChangeset for help on using the changeset viewer.