wpsharks / comet-cache

An advanced WordPress® caching plugin inspired by simplicity.
https://cometcache.com
GNU General Public License v3.0
77 stars 18 forks source link

3rd Party Plugin Compatibility: WPBakery Visual Composer Post Grid #673

Open raamdev opened 8 years ago

raamdev commented 8 years ago

This issue exists to track compatibility between Comet Cache and WPBakery's Visual Composer Post Grid. This article explains one method that could be used to improve integration.

raamdev commented 8 years ago

Mentioned here (internal ticket): https://websharks.zendesk.com/agent/tickets/11238

almeco commented 8 years ago

I vote for this

ThePopularizer commented 8 years ago

I'm experiencing a conflict with Visual Composer's Post Grid at the moment, where, after a few days of having it cached, it would not load; more precisely, it shows the loading graphics, but it would not load the actual posts. Strangely enough, it works fine soon after the cache is cleared or when it is first cached. It's a little difficult to troubleshoot, given this element of time interval. The issue remains even when the exception is made for js_composer in the HTML compressor.

I've also submitted this issue to them on the VC CodeCanyon site.

Thanks for you time!

[re-post]

pavelthq commented 8 years ago

@ThePopularizer Hi, i'm one of core developers of visual composer. Can you please test this snippet:

add_filter('vc_grid_get_grid_data_access','__return_true');
pavelthq commented 8 years ago

Also @raamdev filter I provided disables nonce checking

ThePopularizer commented 8 years ago

Thanks @AngeIII, I've left it for a day, and so far so good.

raamdev commented 8 years ago

add_filter('vc_grid_get_grid_data_access','__return_true'); [...] filter I provided disables nonce checking

@AngeIII Thanks for chiming in here! Could you explain a bit more about what that filter does? ZenCache / Comet Cache specifically disables caching for any pages where it finds a Nonce value being added to the page source (specifically so that there are no issues where a time-sensitive Nonce value might get cached). I'm curious if that's not working as expected, or if Visual Composer is doing something else that is not working right with ZenCache / Comet Cache.

pavelthq commented 8 years ago

@raamdev Okay I will try to explain full process: 1) when grid [vc_basic_grid, vc_media_grid, vc_masonry_grid, vc_masonry_media_grid] being rendered it creates a nonce: data-vc-public-nonce="<?php echo vc_generate_nonce( 'vc-public-nonce' ); ?> 2) function vc_generate_nonce actually calls wp_create_nonce with our prefix

This is being used in javascript ajax call

3) when server receives ajax call [file: include/autoload/hook-vc-grid.php::getGridDataForAjax ] server check if this request is valid [ request data, tag, nonce ] 4) before check server calls filter: 'vc_grid_get_grid_data_access' to actually disable this check.


Summary:

1) it seems system have cached shortcode template with old/wrong nonce 2) also it seems your plugin doesn't have catched wp_create_nonce usage.

raamdev commented 8 years ago

2) also it seems your plugin doesn't have catched wp_create_nonce usage.

Correct, caching a nonce is a bad idea. See What are WordPress nonces and why are they not cache-compatible?

It appears that Visual Composer is not using the standard _wpnonce values but instead using a custom _vcnonce. Comet Cache currently looks for _wpnonce in the page source and disables caching for that page when it finds it. Since Visual Composer is not using the standard _wpnonce, Comet Cache currently caches the page, which causes problems when the _vcnonce expires.


@AngeIII Would it be possible for us to get a copy of Visual Composer Post Grid so that we can look into improving compatibility with Comet Cache? I'd like to run some tests to see if we can make things more seamlessly for our users. raam at websharks-inc dot com is my email.

pavelthq commented 8 years ago

@raamdev sent to your public email in @raamdev.com

raamdev commented 8 years ago

@AngeIII Received. Thank you. I'll add Visual Composer + Comet Cache testing to my todo list and update here again when I have something to add.

renzms commented 7 years ago

Mentioned here in (internal ticket)

Details:

Customer has issues when using Visual Composer with Comet Cache. While Comet Cache is active they are unable to see Visual Composer options in Page(s)/Post(s)/Portfolio(s), etc. When Comet Cache is deactivated it reportedly works fine. Customer has also tried deactivating html compression, but issue still exists.

raamdev commented 7 years ago

@renzms I provided you with a copy of Visual Composer in Slack for testing purposes.

cschalenborgh commented 7 years ago

Fyi @AngeIII, I've experienced the same issue, but with WP Fastest Cache.

This fixed it: add_filter('vc_grid_get_grid_data_access','__return_true');

pavelthq commented 7 years ago

@cschalenborgh note that this filter will disable _vcnonce (wp_verify_nonce) checks for ajax calls.

lukecav commented 7 years ago

Related. http://www.wpfastestcache.com/tutorial/visual-composer-post-grid-problem/

viet0viet commented 7 years ago

I have the exact same problem. Can someone tell me how to add the filter?

kodyaz commented 7 years ago

Thanks @AngeIII This fixed it: add_filter('vc_grid_get_grid_data_access','__return_true'); I use Wp Fastest Cahce.

viet0viet commented 7 years ago

Where did you add the filter? Can you be more specific?

kodyaz commented 7 years ago

hi, wp-include/function.php

raamdev commented 7 years ago

wp-include/function.php

This is not correct. Please don't modify WordPress Core files.

You can add the filter to the bottom of your theme's function.php file (e.g., wp-content/themes/[your-theme]/functions.php) or even better you can create an MU-Plugin and put the filter in there.

thardmanskagit commented 6 years ago

I was having an issue where post grids would show up if I used "preview page" or if I was in incognito mode, but not while accessing the site regularly. I added the code to my function.php file and now it works perfectly!

TFornario commented 6 years ago

Hello, I've tried the filter given by @Angelll but the VC grid still does not show properly. Weird thing is that images DO appear, but the first grid image does not show. Only the first image of the grid. If I have a grid of 4 images, only 3 will appear and the first one is an empty space.

I've installed WP Fastest Cache and added the clear cache rule every 10 hours as described on this page: http://www.wpfastestcache.com/tutorial/visual-composer-post-grid-problem/ - It still doesn't work for me. Has there been any other solutions found to this problem?

Nodws commented 5 years ago

FIXED if your content is in the front page, add this to the functions

$_GET['preview'] = 'true';
remove_action( 'template_redirect', 'redirect_canonical' );