Flying Scripts doesn’t work with WP-Super-Cache
-
I can’t really understand why – but nevertheless, FS fails to change the output when used with WP Super Cache in Expert mode (I don’t think it works in Easy Mode either to be fair, but I don’t use Easy Mode :)).
I /think/ it’s some sort of collision between the 2 plugins and the way they use ob_start(). In Expert Mode, WP-Super-Cache captures all the output from a page/post and stores it on the hard drive, and updated Apache rewrite rules will then serve that static HTML instead of re-running the PHP. This isn’t of itself a problem, provided the Flying Scripts rewrite routine has been called. But it seems not to.
I’ve modified my script to fix this – but I have no idea if it will break other people’s installations. I’ve changed html-rewrite.php as follows;
function flying_scripts_buffer_start() {
ob_start(“flying_scripts_rewrite_html”);
}function flying_scripts_buffer_end() {
ob_end_flush();
}if (!is_admin() ) {
add_action(‘after_setup_theme’, ‘flying_scripts_buffer_start’);
add_action(‘shutdown’, ‘flying_scripts_buffer_end’);
}// W3TC HTML rewrite
add_filter(‘w3tc_process_content’, function ($buffer) {
if ( is_admin() ) {
return $buffer;
}
return flying_scripts_rewrite_html($buffer);
});As I say I don’t understand why this doesn’t work in the current setup – though this way does look like it could be a better way to hook in to the WordPress system anyway and may remove the need to check for admin screens (since after_setup_theme isn’t called when viewing admin screens?)
Anyway, over to the experts – it works for me but I have no visibility of whether this will break something for others ??
- The topic ‘Flying Scripts doesn’t work with WP-Super-Cache’ is closed to new replies.