ESI block not rendering at seemingly random times
-
Hi there,
I’m having some issues with LSCache ESI Blocks. Specifically, speaking I have an ESI Block in my plugin that renders a cart-like widget. This block has been working seamlessly for maybe 4-5 months then one day out of the blue it stopped rendering for all users simultaneously.
Purging cache resolves the issue immediately but it seems to come back about a week or so later. To verify it’s not a problem with the template, I’ve checked the page source to verify that not even the container div is being rendered. It’s almost as if the hook to render it (litespeed_esi_load-nacs-sidebar-cart) is never being called at all.
I’ve simplified my code to the relevant parts below. I also submitted a report from Toolbox > Report during the time our production site was having issues with this rendering this block. Any advice or potential fix would be greatly appreciated.
Report number: YFBQPQQY
Report date: 03/15/2022 22:03:35
add_action( 'plugins_loaded', function() { if( function_exists( 'WC' ) ) { add_action( 'litespeed_esi_load-nacs-sidebar-cart', 'esi_output_cart_sidebar' ); add_action( 'wp_body_open', 'output_cart_sidebar' ); } } ); function esi_output_cart_sidebar() { do_action( 'litespeed_control_set_nocache' ); echo get_cart_sidebar_html(); } function output_cart_sidebar() { if( !apply_filters( 'litespeed_esi_status', false ) ) { echo get_cart_sidebar_html(); return; } echo apply_filters( 'litespeed_esi_url', 'nacs-sidebar-cart', 'NACS Sidebar Cart'); } /** * Gets the cart sidebar html */ function get_cart_sidebar_html( $is_fragments = false ) { $viewbag = [ 'cart' => WC()->cart, 'is_fragments' => $is_fragments, ]; $html = nacs_template_part( 'cart-sidebar', null, $viewbag ); return $html; }
- The topic ‘ESI block not rendering at seemingly random times’ is closed to new replies.