Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision Next revision Both sides next revision | ||
litespeed_wiki:cache:lscwp:esi_nonce [2017/09/24 15:19] Hai Zheng created |
litespeed_wiki:cache:lscwp:esi_nonce [2017/09/24 16:29] Hai Zheng |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | WPBakery Page Builder Version 5.3 | + | Note: LiteSpeed WordPress Cache plugin needs to be v1.2.4+. |
+ | |||
+ | Let's take ** WPBakery Page Builder Version 5.3 ** as an example. It used WordPress nonce in frontend. So once it got cached, the nonce will fail to pass validation once expired. With ESI, it can be made to a private/public cache separate from full page. | ||
+ | |||
+ | This is how to do it manually: | ||
In <code>js_composer/include/helpers/helpers_factory.php</code> line 486, | In <code>js_composer/include/helpers/helpers_factory.php</code> line 486, | ||
Line 11: | Line 15: | ||
<syntaxhighlight lang='php'> | <syntaxhighlight lang='php'> | ||
function vc_generate_nonce( $data, $from_esi = false ) { | function vc_generate_nonce( $data, $from_esi = false ) { | ||
- | if ( ! $from_esi ) { | + | if ( ! $from_esi && ! vc_is_frontend_editor() ) { |
if ( method_exists( 'LiteSpeed_Cache_API', 'esi_enabled' ) && LiteSpeed_Cache_API::esi_enabled() ) { | if ( method_exists( 'LiteSpeed_Cache_API', 'esi_enabled' ) && LiteSpeed_Cache_API::esi_enabled() ) { | ||
if ( method_exists( 'LiteSpeed_Cache_API', 'v' ) && LiteSpeed_Cache_API::v( '1.2.4' ) ) { | if ( method_exists( 'LiteSpeed_Cache_API', 'v' ) && LiteSpeed_Cache_API::v( '1.2.4' ) ) { |