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:
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)
@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:
@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:
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 :-
Theme Location option on Groovy options page

Identify the root cause :white_check_mark:
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.