Skip to content

Instantly share code, notes, and snippets.

@robertstaddon
Last active October 30, 2022 05:44
Embed
What would you like to do?
Turn Astra Secondary Menu into LiteSpeed ESI Block
<?php
add_filter( 'wp_nav_menu', function( $nav_menu_html, $args ) {
if ( $args->menu_id == "ast-hf-menu-2" ) {
if ( apply_filters( 'litespeed_esi_status', false ) )
return apply_filters( 'litespeed_esi_url', 'astra_secondary_menu', 'Secondary Menu', array( 'nav_menu_html' => $nav_menu_html, 'args' => $args ), $control = 'private,no-vary', $silence = false );
}
return $nav_menu_html;
}, 10, 2);
add_action( 'litespeed_esi_load-astra_secondary_menu', function ( $atts ) {
echo $atts['nav_menu_html'];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment