@zyzz3031 Could you please try to add the following code to your active child theme’s functions.php file and check if it helps to fix the issue?
add_action('init','purge_cache');
function purge_cache(){
if ( function_exists( ‘WP_Optimize()->get_page_cache()->purge’ ) ) {
WP_Optimize()->get_page_cache()->purge();
}
}
i added the code on the bottom of the functions.php file and saved, then my site crashed and didnt work anymore
what have i done wrong?
@zyzz3031 Can you please enable debugging mode, Please add following lines to wp-config.php just before where it says: /* That’s all, stop editing! Happy publishing. */
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
Then try to reload the page.
A debug.log file should be created inside wp-content folder,which should contain error information in it, Please share the file with us.
@zyzz3031 The correct code should be
add_action('init','purge_cache');
function purge_cache(){
if (is_callable(array(WP_Optimize()->get_page_cache(), 'purge'))) {
WP_Optimize()->get_page_cache()->purge();
}
}
hi,
i added the new code, but it does nothing. only new thing is, that under cache, the size and file count always stays at 0.
and i already before, every time i manualy load the cache, the first time i click the button i get the error message: an unexpecter request was received
@zyzz3031 At the first attempt you see “an unexpecter request was received” but if you click the Preload button again it will preload the urls.
Yes it will preload the cache if i click it another time.
But the thing is, when i preload the cache the fist time, it never has the right amount.
For excample:
I clear the cache, then preload.
It says. 1mb 10 files
After clearing and preloading again it says. 2,5mb and 55 files.
And when i repeat that process again, it keeps telling me 2,5mb and 55 files. So thats the right cache.
But this problem was already before your code i tried.
And my main problem was/is that after the coreect cache size is loaded after the second attempt, i dont make any changes to the site. No plugins updates or any changes to the page, and every day the cache says some different size.
Sometimes its 17mb and 200 files, the next day its 0.3mb and 2 files….
I really dont get it whats wrong.
If you want, you can have access to the site and see for yourself
I have a second website at a different hoster and there is the same probleme. Site cache size changes everyday without the site changing anything.
Either i am to stupid to use this plugin and say cache the size and only reload everymonth or there is a big problem with your plugin