Programmatically purge all cache and minify data
-
Dear WP-Optimize team,
I am using a facility on my website to put it in maintenance mode, so that only admin users get access and other users get a nice “website out of order”-message.
The changes on the website for which I put it in maintenance mode often require that old cached data will no longer be used afterwards. Therefore I built in my software a facility so that, when the website is put back online, the WP-Optimize page and minify caches are automatically purged.
To do this I used an ‘undocumented’ WP-Optimize feature and I would like to be sure that the way I did this is correct.
Here is my PHP function:
function my_theme_clear_wpo_caches() { if ( ! defined( 'WPO_PLUGIN_MAIN_PATH' ) ) return false; if ( ! class_exists( 'WP_Optimize_Minify_Commands' ) ) include_once( WPO_PLUGIN_MAIN_PATH . 'minify/class-wp-optimize-minify-commands.php' ); $minify_commands = new WP_Optimize_Minify_Commands(); return $minify_commands->purge_all_minify_cache(); }
I would very much appreciate if you could let me know if this is indeed all right. Of course I could simply delete the folders wpo-cache and wpo-minify but I would like to be sure to avoid creating conflicts with any administration WP-Optimize may maintain about its cache data.
Best regards,
Henk Barreveld
- The topic ‘Programmatically purge all cache and minify data’ is closed to new replies.