No results found. Try again with different words?

Search must be at least 3 characters.

Clearing Cache with Spectra Actions

Spectra ensures your website visitors always see the latest version by working its magic behind the scenes.

Just like a temporary storage space, a website cache holds website elements to improve loading speed for returning visitors. While caching is generally helpful, sometimes it’s necessary to clear the cache to show recent updates on your website.

Spectra takes care of this automatically whenever you make changes to your website. It also integrates smoothly with popular caching plugins to manage your website’s cache efficiently.

This means you can focus on creating great content without worrying about the technical aspects.

This document explains how you can clear the cache of a website using Spectra actions.

Why You Need to Clear the Cache?

Migrating your site to a new host may bring about challenges, potentially resulting in site breakages. Furthermore, tweaking a post may disrupt CSS, affecting the display on mobile or desktop devices.

Similarly, regenerating site assets might occasionally cause the site to appear broken for your website users.

These issues commonly arise in environments with caching mechanisms like Varnish in Cloudways, file-based caching in SiteGround or something similar.

Typically, when changes are made to a page or the entire site, you should purge the cache to ensure the latest resources are served. Problems arise when the caching environment retains old resource URLs that are no longer available.

To streamline this process using Spectra actions, we’ve implemented internal hooks that allow purge functions to be seamlessly integrated.

This automation ensures that you can maintain an up-to-date and consistent experience by automatically purging outdated cache when changes are made.

We are trying to provide compatibility from our side for some of the known hosts.

How to Add Code Snippets to Your Website?

The below mentioned steps shows how to add code snippets to your WordPress website using a popular plugin called “Code Snippets.”

While we’re expanding support for various hosting providers and plugins in the future, here’s how to achieve this using Code Snippets for now:

Prerequisites:

  • Ensure you have the “Code Snippets” plugin installed and activated on your WordPress website.

Steps:

  1. In your WordPress dashboard, locate the “Snippets” module.
  2. Within the “Snippets” section, look for the option to “Add New”.
  3. Give your code snippet a clear and descriptive title for easy identification later.
  4. Locate the tab labeled “Functions”. This is where you’ll paste the below attached code.
  5. Once you’ve pasted your code and ensured it’s correct, click the “Save Changes and Activate” button.
add_action( 'uagb_delete_uag_asset_dir', 'clear_cache' );
add_action( 'uagb_delete_page_assets',  'clear_cache' );

function clear_cache(){
    // purge_cache_function(); Call cache function in your environment
}

By following these steps, you can easily add code snippets to your WordPress website using the “Code Snippets” plugin.

Frequently Asked Questions

Was this article helpful?


Did not find a solution? We are here to help you succeed.

Related Docs
Build Ultra High Performance
Websites, Without Coding

Whether you are a beginner, marketer, or professional, Spectra has the tools and resources you can rely on to succeed

Get Notified When Available

Note - You can purchase the Essential Toolkit now and easily upgrade to the Business Toolkit once it becomes available.

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Get your hands on Spectra Pro

Enter your name and email address to get access to Spectra Pro.