<?php
/**
* Flush Elementor buffers for bug with Image Optimization feature
* Only necessary for Elementor versions 3.17 – 3.19.4
* The bug was fixed in Elementor 3.20.0
**/
add_action( 'shutdown', function() {
if ( FWP()->request->is_refresh ) {
$buffer = ob_get_status();
if ( 'Elementor\Modules\ImageLoadingOptimization\Module::handle_buffer_content' == $buffer['name'] ) {
ob_end_flush();
}
}
}, -1 );