Answer the question
In order to leave comments, you need to log in
How to disable caching for some objects in wordpress (WP Super Cache)?
How to disable caching in WP Super Cache plugin for some objects like div with no-cache class? Or is it better to use another plugin? Or even without plugins?
Answer the question
In order to leave comments, you need to log in
More or less like this:
define( 'DYNAMIC_CACHE_TEST_TAG', '' ); // Change this to a secret placeholder tag
if ( DYNAMIC_CACHE_TEST_TAG != '' ) {
function dynamic_cache_test_safety( $safety ) {
return 1;
}
add_cacheaction( 'wpsc_cachedata_safety', 'dynamic_cache_test_safety' );
function dynamic_cache_test_filter( &$cachedata) {
return str_replace( DYNAMIC_CACHE_TEST_TAG, "<!-- Hello world at " . date( 'H:i:s' ) . " -->", $cachedata );
}
add_cacheaction( 'wpsc_cachedata', 'dynamic_cache_test_filter' );
function dynamic_cache_test_template_tag() {
echo DYNAMIC_CACHE_TEST_TAG; // This is the template tag
}
function dynamic_cache_test_init() {
add_action( 'wp_footer', 'dynamic_cache_test_template_tag' );
}
add_cacheaction( 'add_cacheaction', 'dynamic_cache_test_init' );
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question