简体   繁体   中英

wp-super-cache, reload from php

Is it possible to reload (or delete) the wp-super-cache from a php script? Is there a specific function for that?

http://ocaoimh.ie/wp-super-cache-developers/ says:

Clearing the Cache

The development version of the plugin includes the following function. However, as this code hasn't been released you cannot depend on this function being available on WordPress blogs just yet.

 1 function wp_cache_clear_cache() { 2 global $cache_path; 3 prune_super_cache( $cache_path . 'supercache/', true ); 4 prune_super_cache( $cache_path, true ); 5 } 

If you need this functionality in a plugin now, call prune_super_cache() directly. Please sanity check it however as it's a very powerful command!

Delete the cache files for a single post by using the wp_cache_post_change( $post_id ) function. It will attempt to delete every half-on cache file for that post, as well as any supercache files.

You can reload it from the administration panel. If you want to do it remotely, you can write a script that simply

rm -rf [cache dir]

Just see where you have that dir.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM