Title: Flying Scripts doesn&#8217;t work with WP-Super-Cache
Last modified: October 28, 2020

---

# Flying Scripts doesn’t work with WP-Super-Cache

 *  Resolved [snibbo71](https://wordpress.org/support/users/snibbo71/)
 * (@snibbo71)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/flying-scripts-doesnt-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 🙂

Viewing 1 replies (of 1 total)

 *  Plugin Author [Gijo Varghese](https://wordpress.org/support/users/gijo/)
 * (@gijo)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/flying-scripts-doesnt-work-with-wp-super-cache/#post-13850430)
 * Since both use ob_start, one will get priority over other. after_setup_theme 
   and shutdown can’t capture complete HTML. Anyway I’ll check if there is anything
   we can do in the next updates.

Viewing 1 replies (of 1 total)

The topic ‘Flying Scripts doesn’t work with WP-Super-Cache’ is closed to new replies.

 * ![](https://ps.w.org/flying-scripts/assets/icon-256x256.png?rev=2240444)
 * [Flying Scripts: Delay JavaScript to Improve Site Speed & Performance](https://wordpress.org/plugins/flying-scripts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/flying-scripts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/flying-scripts/)
 * [Active Topics](https://wordpress.org/support/plugin/flying-scripts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/flying-scripts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/flying-scripts/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Gijo Varghese](https://wordpress.org/support/users/gijo/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/flying-scripts-doesnt-work-with-wp-super-cache/#post-13850430)
 * Status: resolved