Clear Cache via URL

Clear Cache via URL

by admin

There are some features which provide you to clear cache via admin panel. You need to have to login into the wordpress admin panel.

However, you can clear cache via URL. You need to follow the steps below to be able to clear cache via URL.

1. Define token

Method 1: Using wp-config.php

You need to define and add the security token after <?php which exists at the top of wp-config.php file. You can use any letter or digit.

define('WPFC_CLEAR_CACHE_URL_TOKEN', "123abc");

Method 2: Using Filter

If you need to remove the footer comment from the html source, you can use the following filter. You can the filter on your theme’s functions.php file.

add_filter('wpfc_clear_cache_url_token', function() {
    return "123abc";
});

2. Open URL

– Clearing Cache of a Specific Post

– If you want to clear the cache of a post, you need to use type=clearcache and post_id=XXXX as below.

https://YOUR-SITE-URL.com/?
action=wpfastestcache&type=clearcache&post_id=XXXX&token=123abc

– Clear All Cache

– If you just want to clear all cache, you need to use type=clearcache as below.

https://YOUR-SITE-URL.com/?
action=wpfastestcache&type=clearcache&token=123abc

– Clear Cache for All Sites in MultiSite Installation

– If you use the MultiSite installation and want to clear all cache of all the sites, you need to use clearcacheallsites as below.

https://YOUR-SITE-URL.com/?action=wpfastestcache&type=clearcacheallsites&token=123abc

Clear All Cache and Minified Sources

– If you want to clear all cache and minified sources, you need to use type=clearcacheandminified as below.

https://YOUR-SITE-URL.com/?action=wpfastestcache&type=clearcacheandminified&token=123abc

Cron Job

You may ask why I need to add a cron job when there is a cache timeout feature.

The Cache Timeout feature works with WP Schedule which works when someone visits your WordPress site. If your site doesn’t receive a lot of traffic, WP Schedule may not work properly so you need to add a cronjob.

wget -O - "https://www.YOUR-URL.com/?action=wpfastestcache&type=clearcache&token=123abc" >/dev/null 2>&1

Related articles

Clear Cache After Theme or Plugin Update
Clear Cache After Theme or Plugin Update

When you update any plugin or theme, the entire cache may need to be cleared.

WP-CLI Commands
WP-CLI Commands

WP-CLI is a command-line tool specifically designed for managing WordPress websites, offering users the ability to perform a wide range…

Using Varnish Cache with WP Fastest Cache
Using Varnish Cache with WP Fastest Cache

Proxy cached content is automatically cleared when the cache created by WP Fastest Cache is cleared.

Ready to get started?

Purchase your first license and see why 1,500,000+ websites globally around the world trust us.