Exclude Dynamic Menu and Shortcode Content
-
Hi,
I need to exclude parts of my homepage from cache.
On my homepage, the elements to exclude from cache are :
1- A dynamic menu : Variable if the user is logged in or logged out
2- A dynamic content placed thanks to a shortcode1> For the menu, how to exclude it from the cache ? To manage login status, I use the plugin “User Menus”. May I use the “ESI Nonces” for that ?
2> For the dynamic content with the shortcode, I know about the ‘esi’ to include in a shortcode (https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:esi:shortcode), but how to manage it for my use case ?
Thank you for your help,
Regards,
Law
-
Hi,
1) you can try to use “cache login user” , that will make 2 caches , 1 for guest user, 1 for login user
2) what do you mean how to manage it ? ESI shortcode didn’t work ?
Best regards,
Hi,
1/ Thank you
2/ Oh I should have misunderstood how it works. So on a cached page, put [esi shortcode …] will not cache the content of ‘shortcode’ ? If it is that, that’s perfect.Regards,
LawHi,
Yes, on a cached page
for example you have a block
[something], page cached and this code won’t be changingand then if you make it ,
[esi something ttl="0"], then this block will no be cached while parent page can still be cached.and , in other case,
[esi something ttl="3600"], then this block will be cached for one hourand so on.
but currently , ESI shortcode only works with single shortcode, some plugin uses short code like this
[some]xxx[/some], in this case, ESI won’t work properlyBest regards,
perfect, many thanks !
Hi,
So I’ve tried :
– Activate ESI button
– Put my shortcode withttl="604800"But it made my website incredibly slow, and timeouts in the Admin.
When I removed the shortcode, the site remained very slow. It’s been solved when disabling ESI.
Would you see some incompatibilities of ESI with Cloudflare that I use, or with something else ?
Thank you,
Regards,
LawHi,
ESI won’t effect in wp-admin URL
when you enable ESI, please check in HTML source code , search for keyword “<!– Block generated by LiteSpeed Cache”
each ESI request is ONE sub-PHP-request which could be costly , make sure you don’t put too many ESI block
Best regards,
thank you
The topic ‘Exclude Dynamic Menu and Shortcode Content’ is closed to new replies.