Clear your browser cache and cookies

Your browser stores copies of a site's files (its cache) and small pieces of login and session data (cookies). This speeds up repeat visits, but it also means you can keep seeing an old version of a page, or run into stale login issues, after something has already changed on the site. Clearing them forces the browser to fetch a fresh copy.

Hard-refresh a single page

The quickest fix is a hard-refresh, which reloads the current page while ignoring the cached files:

  • Windows / Linux: Ctrl + Shift + R
  • Mac: Cmd + Shift + R

If that doesn't help, clear the cache and cookies fully.

Clear the cache and cookies

The exact steps differ slightly between browsers, but the location is similar in all of them:

  • Chrome / Edge: Settings → Privacy and security → Clear browsing data. Set the time range to All time, tick Cached images and files and Cookies and other site data, then clear.
  • Firefox: Settings → Privacy & Security → Cookies and Site Data → Clear Data, tick both options, then clear.
  • Safari: Safari → Settings → Privacy → Manage Website Data → Remove All, or use Safari → Clear History and choose all history.

After clearing, reload the site.

When changes to CSS or JavaScript still don't show

If you edit a theme's CSS or JavaScript and the change doesn't appear even after clearing your own browser cache, your visitors will have the same problem - their browsers are still holding the old file. The proper fix is cache busting: telling browsers a new version of the file is available by changing its version identifier.

WordPress supports this through the version parameter when enqueuing styles and scripts. You can bump a theme's version manually in its style.css, or set the version to the file's last-modified time so it updates automatically whenever you edit the file:

function templ_cache_busting_enqueue_styles() {
    $cssFileTime = date( "YmdHi", filemtime( get_stylesheet_directory() . '/my-css-file.css' ) );
    wp_enqueue_style( 'my-css-file', get_stylesheet_directory_uri() . '/my-css-file.css', array(), $cssFileTime );
}
add_action( 'wp_enqueue_scripts', 'templ_cache_busting_enqueue_styles' );

Add this to your theme's functions.php, and put your custom CSS in my-css-file.css (or change the filename in the snippet to match your own). Each time you edit the file, the version identifier changes and browsers download the new version.