Wp-rocket: Groovy Menu plugin incompatibility

Created on 14 May 2020  路  11Comments  路  Source: wp-media/wp-rocket

Describe the bug
Groovy Menu is handling the output buffering incorrectly. Since there are a lot of buffer clearing functions and if statements, I haven't tried to find the issue.

Our File Optimization features are not applied when this plugin is active.

To Reproduce
Steps to reproduce the behavior:

  1. Enable WP Rocket
  2. Enable Groovy Menu
  3. Make sure that the menu on the site is handled by Groovy Menu
  4. Confirm that File Optimizations are not applied

Expected behavior
WP Rocket working correctly with Groovy Menu.

Additional context
Plugin URL:
https://codecanyon.net/item/groovy-menu-wordpress-mega-menu-plugin/23049456)

Tested on 1.9.9 version (March 12, 2020)

We have a couple of tickets regarding this problem, for example:
https://secure.helpscout.net/conversation/1162575142/164616?folderId=2415573

Backlog Grooming (for WP Media dev team use only)

  • [x] Reproduce the problem
  • [x] Identify the root cause
  • [ ] Scope a solution
  • [ ] Estimate the effort
3rd party compatibility file optimization r&d low bug

All 11 comments

@piotrbak Wondering if this is something we can actually fix or if it's something that will be a known incompatibility.

~Do you happen to have the plugin? Please share with me if you do.~

Camila reported that this happened with the free version of the plugin as well: https://wordpress.org/plugins/groovy-menu-free/

@wp-media/wprocketplugin We have more and more compatibility issues about this buffering problem.

Will it be possible to find a solution?

When we have an incompatibility where the 3rd party plugin/theme/etc. is incorrectly "handling the output buffering", what's our guiding principle from a product point-of-view:

  • Full compatibility?
  • Detect and alert?
  • Work with the 3rd party to resolve the compatibility issues?
  • or maybe a combination?

@GeekPress what do you recommend for our approach?

This issue is now more and more common. As a user point of view, they just don't care the 芦聽why聽禄 of the problem. A user installs WP Rocket, turn on some options, it doesn't work for X reason. A user just wants the issue to be fixed.

And it's even more important when a competitor doesn't have the same issue :
https://github.com/wp-media/wp-rocket/issues/2330#issuecomment-632214253

Thanks @GeekPress. We'll take a look in the next grooming session.

@hellofromtonya Here the list of plugins we have a conflict for the same reason:
https://www.notion.so/wpmedia/Known-Conflicts-8d0a97af9b9c49dd991b28b24550e3de#96b040caf005488eb9afcf7cac4193a0 (check 芦聽buffer聽禄 keyword.

Update:

  • On Mega and on my test site, the free version of the Groovy menu caused the issue.
  • On customer's site, the issue was apparently fixed after the Grooni support added Groovy Menu integration to their Child theme.

From https://secure.helpscout.net/conversation/1177616649/168498?folderId=2675957.

Reproduce the issue :white_check_mark:
I was able to reproduce this issue locally and on Camila's own site.
The problem happens when :-

  1. The theme doesn't have any menu positions or it has but not selected on Theme Location option on Groovy options page
    image
  1. Enabling automatic integration option so groovy here is outputting the menu after opening body tag.
    image

Identify the root cause :white_check_mark:

  • This plugin uses ob_get_clean and ob_end_clean clearing the buffer before WP Rocket's optimizations are applied.

Scope a solution :white_check_mark:
We can load html of the page with previously triggered action like init instead of template_redirect with the lowest priority. and that can solve multiple compatibility issues.

We would have to be extra careful if we change the action and priority here, because it can have unexpected side effects. Also init is fired on both admin and frontend, contrary to template_redirect, so we will have to make sure we have an admin check.

I'd advise staying with template_redirect for the reasons that @Tabrisrp has specified.

In talking with @engahmeds3ed last night, the root of the problem here is that this particular plugin hooks into template_redirect at priority 0. Rocket's priority is 2.

Why is this the problem? The Groovy Menu plugin's callback runs _before_ Rocket. Any plugin or theme that runs _before_ Rocket's callback will not be captured by our buffer.

A solution for this issue is to lower the priority number. However, in doing that, we risk impacting other customer websites.

Therefore, we would need to do extensive testing on multiple customer environments to determine if lowering the priority number is the right solution for all customers and this particular issue.

I think this issue needs R&D.

Was this page helpful?
0 / 5 - 0 ratings