Code-Snippets-Functions/Returns information from child Site/Autoptimize
Sebastian Moran 425ad2388b
Update README.md
Bump WordPress version.
2021-08-10 12:19:41 -06:00
..
autoptimize.php Adding Cache Clearing for Autoptimize and LiteSpeed cache plugins 2019-07-04 10:30:50 +02:00
README.md Update README.md 2021-08-10 12:19:41 -06:00

Autoptimize Clearing Cache on your Child Sites

Tested version of WordPress 5.8.

This file is a code snippet that is used for Autoptimize By Frank Goossens (futtta).

Things to do

  1. If your not sure what this does check the Code Snippets Functions Readme
  2. As with all code snippets located in this git, TEST the code snippet on one of your test sites BEFORE sending the code snippet to all your MainWP Child sites!

Code snippet functions help

If you run into any issues or questions please use the MainWP Support page and open a ticket for the fastest response.

Cache Enabler Clearing Cache Tutorial

Autoptimize Clear Cache API and Clearing Cache discussion on GitHub Issues code and example found on the GitHub repository of the plugin.

The PHP snippet below can be used to clear the cache via a third party such as a Cron Job for example. The first section initializes the WordPress environment, normally this PHP file should be located in your WordPress root directory. The second if performs the action of completely clearing the cache and with the third if you have the ability to specify which post ID you would like to clear the cache for.

// initilize WordPress environment
if ( !defined('ABSPATH') ) {
	require_once('./wp-load.php');
}

if (class_exists('autoptimizeCache')) {
  autoptimizeCache::clearall();
  echo "Autoptimize Cache cleared successfully!";
} else {
  echo "Autoptimize Clearing cache failed!";
}