Skip to content

labatt/sd-cachebust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

SD Unified Cache Clear

One button to clear all caches from WP Rocket, SiteGround, and Divi.

Description

This WordPress plugin adds a single button to your admin toolbar that clears caches from multiple caching systems with one click:

WP Rocket

  • Clear and Preload cache
  • Purge this URL
  • Clear used CSS of this URL
  • Clear priority elements of this URL
  • Clear all minified CSS/JS

SiteGround Optimizer

  • Purge SG cache

Divi

  • Clear static file CSS generation
  • Clear local storage

Features

  • Single toolbar button for all cache clearing operations
  • Visual feedback with spinning icon during cache clear
  • Success/error notifications
  • Works on both frontend and admin
  • Only visible to administrators
  • Gracefully handles when plugins are not active

Installation

  1. Upload the sd-unified-cache-clear.php file to your /wp-content/plugins/ directory, or install it as a mu-plugin by placing it in /wp-content/mu-plugins/
  2. Activate the plugin through the 'Plugins' menu in WordPress (if installed as regular plugin)
  3. Look for the "Clear All Caches" button in your admin toolbar

Usage

  1. Simply click the "Clear All Caches" button in the admin toolbar (top right)
  2. The icon will spin while caches are being cleared
  3. A success message will appear when complete
  4. If any plugin is not active, it will be skipped automatically

Requirements

  • WordPress 5.0 or higher
  • Administrator capabilities
  • At least one of the supported caching plugins installed

Supported Caching Plugins

Technical Details

WP Rocket Integration

The plugin uses these WP Rocket functions:

  • rocket_clean_domain() - Clears all cache files
  • run_rocket_sitemap_preload() - Preloads cache
  • rocket_clean_files($url) - Purges specific URL
  • rocket_clean_post_cache($post_id) - Clears post cache including used CSS
  • rocket_clean_minify() - Clears minified files
  • Manual deletion of used-css and critical-css directories
  • Removes priority elements post meta

SiteGround Integration

The plugin uses:

  • SiteGround_Optimizer\Supercacher\Supercacher class
  • sg_cachepress_purge_cache action hook
  • Direct function calls when available

Divi Integration

The plugin uses:

  • et_core_clear_theme_static_css_folder() - Clears static CSS
  • et_core_clear_cache_folder() - Clears cache folder
  • ET_Core_PageResource class for clearing page resources
  • JavaScript to clear localStorage items (et_* and divi* prefixed)

AJAX Implementation

The plugin uses WordPress AJAX to clear caches without page reload:

  • Action: sd_clear_all_caches
  • Nonce protected
  • Returns JSON response with results from each caching system

Filters and Hooks

Currently, this plugin doesn't expose any filters or hooks, but they can be added if needed.

Changelog

1.0.0

  • Initial release
  • Support for WP Rocket, SiteGround, and Divi
  • Single toolbar button with AJAX functionality
  • Visual feedback and notifications

License

GPL v2 or later

Author

SD - https://github.com/labatt

Support

For issues and feature requests, please use the GitHub repository: https://github.com/labatt/sd-cachebust

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages