comet-cache icon indicating copy to clipboard operation
comet-cache copied to clipboard

3rd Party Plugin Compatibility: WPBakery Visual Composer Post Grid

Open raamdev opened this issue 8 years ago • 24 comments

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 avatar Feb 18 '16 02:02 raamdev

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

raamdev avatar Feb 18 '16 02:02 raamdev

I vote for this

almeco avatar Feb 18 '16 07:02 almeco

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]

ThePopularizer avatar Feb 21 '16 23:02 ThePopularizer

@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 avatar Feb 22 '16 16:02 pavelthq

Also @raamdev filter I provided disables nonce checking

pavelthq avatar Feb 23 '16 10:02 pavelthq

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

ThePopularizer avatar Feb 23 '16 16:02 ThePopularizer

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.

raamdev avatar Feb 25 '16 16:02 raamdev

@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

  1. when server receives ajax call [file: include/autoload/hook-vc-grid.php::getGridDataForAjax ] server check if this request is valid [ request data, tag, nonce ]
  2. 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.

pavelthq avatar Feb 25 '16 18:02 pavelthq

  1. 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.

raamdev avatar Feb 26 '16 14:02 raamdev

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

pavelthq avatar Feb 26 '16 15:02 pavelthq

@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.

raamdev avatar Feb 26 '16 15:02 raamdev

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.

renzms avatar Dec 20 '16 04:12 renzms

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

raamdev avatar Dec 20 '16 17:12 raamdev

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');

cschalenborgh avatar Jan 19 '17 12:01 cschalenborgh

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

pavelthq avatar Jan 19 '17 13:01 pavelthq

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

lukecav avatar Apr 12 '17 22:04 lukecav

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

viet0viet avatar Jun 16 '17 13:06 viet0viet

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

kodyaz avatar Jun 18 '17 10:06 kodyaz

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

viet0viet avatar Jun 19 '17 07:06 viet0viet

hi, wp-include/function.php

kodyaz avatar Jun 19 '17 09:06 kodyaz

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.

raamdev avatar Jun 19 '17 21:06 raamdev

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!

thardmanskagit avatar Oct 05 '17 23:10 thardmanskagit

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?

TFornario avatar Jan 22 '18 07:01 TFornario

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

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

Nodws avatar May 23 '19 18:05 Nodws