开发者 | apos37 |
---|---|
更新时间 | 2025年5月7日 23:21 |
PHP版本: | 7.4 及以上 |
WordPress版本: | 6.8 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
wordpress_logged_in_*
)./wp-content/plugins/clear-cache-everywhere/
directory.It flushes WordPress object cache, transients, sessions, rewrite rules, and any configured third-party caches. If a hosting cache purge URL is set, it will be called as well. Additionally, it forces browsers to reload fresh content.
This depends on your hosting provider. If they offer a cache purge URL, you can configure it in the plugin settings. For example, if you have GoDaddy's Website Security and Backups, you can navigate to Firewall > Settings > Performance > Clear Cache, then grab the Clear Cache API link.
Yes! The plugin sends cache-control headers to prompt browsers to reload updated content.
Yes! Developers can hook into cceverywhere_after_clear_cache
and cceverywhere_custom_settings
:
`<?php
// Action to purge a custom cache directory after clearing cache
add_action( 'cceverywhere_after_clear_cache', function() {
// Check if the custom cache purge option is enabled
$prefix = 'clear_cache_everywhere_';
if ( get_option( $prefix . 'purge_custom_cache_directory', false ) ) {
// Purge a custom cache directory
$cache_dir = WP_CONTENT_DIR . '/cache/myplugin/';
if ( file_exists( $cache_dir ) ) {
array_map( 'unlink', glob( $cache_dir . '*' ) );
}
}
} );
// Filter to add custom settings field for the action above
add_filter( 'cceverywhere_custom_settings', function( $fields ) {
// Define a custom checkbox field
$fields[] = [
'key' => 'purge_custom_cache_directory',
'title' => ( 'Purge Custom Cache Directory', 'clear-cache-everywhere' ),
'type' => 'checkbox',
'sanitize' => 'sanitize_checkbox',
'section' => 'custom',
'default' => FALSE,
'comments' => ( 'Enable this option to automatically purge a custom cache directory (e.g., for your plugin\'s cache). The cache will be cleared after the global cache is cleared.', 'clear-cache-everywhere' ),
];
return $fields;
} );
?>`
Yes! A helper function is available for you to use: cceverywhere_clear_all( $log_results = false )
.
The function returns the results of the cache clearing processing. Optionally, you can log the results by setting the $log_results
parameter to true
. This will log the results to the debug log.
Join my Discord support server