Repository navigation
Description
Description
Since 4.2.12 (PR #1132, "process page HTML outside PHP's output-buffer display handler"), Groovy Menu's header menu no longer appears on the front end. Rolling back to 4.2.11 fixes it. So does adding add_filter( 'optml_capture_at_shutdown', '__return_false' ); on 4.2.12.
Cause: Groovy Menu's Divi auto-integration starts its own output buffer on init (priority 0). On shutdown (priority 0) it runs ob_get_clean() and inserts the menu HTML after <body>. In 4.2.12, Optml_Manager::close_buffer() is hooked to shutdown at PHP_INT_MIN (inc/manager.php:428) and flushes every buffer above Optimole's own:
while ( ob_get_level() > self::$ob_level ) { if ( ! @ob_end_flush() ) { break; } }
That flushes Groovy Menu's buffer before Groovy's shutdown callback runs. Groovy then gets Optimole's empty buffer, finds no <body>, and the fully generated menu HTML (~40 KB) is thrown away.
Expected: the Groovy Menu is inserted into the page, as it was on 4.2.11.
Actual: the menu markup is missing on every page. Only Groovy Menu's inline JS settings are printed.
Step-by-step reproduction instructions
- Install the Divi theme and Groovy Menu (premium) and enable Groovy Menu's auto-integration for Divi. Assign a menu to the "Groovy menu Primary" location.
- Install Optimole 4.2.12 (or 4.2.13), connect it, and leave image replacement enabled.
- Load any front-end page with page caching bypassed.
- The Groovy Menu markup (
.gm-navbar,.gm-preset-id-*wrapper) is missing from the HTML. - Roll back to Optimole 4.2.11, or add
add_filter( 'optml_capture_at_shutdown', '__return_false' );, and reload: the menu appears.
Screenshots, screen recording, code snippet or Help Scout ticket
Buffer stack traced on an uncached render (PHP CLI, same page):
- After the template finishes, ob_level=5:
Optml_Manager::handle_buffer_fallback → default output handler (Groovy Menu) → SiteGround_Optimizer\Parser\Parser::run → hefo_callback → wp_finalize_template_enhancement_output_buffer - At
shutdownpriority -1, ob_level=1: only Optml_Manager::handle_buffer_fallback remains - Groovy's
groovy_menu_final_outputfilter receives a string of length 0
Same render with optml_capture_at_shutdown → false: Groovy receives the full page (~188 KB) and the menu is inserted.
On a live site the menu disappeared the morning after the auto-update to 4.2.12. It came back after rolling back to 4.2.11.
Possible directions:
- Run the flush/capture later in
shutdown(after default-priority callbacks) instead of at PHP_INT_MIN. - If other buffers are still open above Optimole's, fall back to the pre-4.2.12 behaviour instead of force-flushing them.
- At minimum, document
optml_capture_at_shutdownas a supported compatibility switch.
Environment info
WordPress 7.1, PHP 8.2.33, Optimole 4.2.12/4.2.13 (last working: 4.2.11), Divi 4.27.7, Groovy Menu 2.6.5, WP Rocket 3.23.x, SiteGround Optimizer 7.8.x, Header and Footer 3.3.6
Is the issue you are reporting a regression
Yes, this is a regression.
Activity
pirate-bot commentedon Sep 15, 2026
Another customer reported this via support.
Groovy Menu markup disappears from front-end pages when Optimole 4.2.12 or 4.2.13 is active with the Divi theme. This regression stems from commit
d6cc7b54ininc/manager.php, which introduced shutdown-based output capture (Optml_Manager::close_buffer()) atPHP_INT_MIN. This flushes buffers stacked above Optimole's buffer before Groovy Menu's own shutdown callback can retrieve and transform its buffer, leaving it empty. To reproduce, install Divi and Groovy Menu with auto-integration enabled, activate Optimole 4.2.12 or 4.2.13, and inspect an uncached front-end page where the menu wrapper will be missing (unlike v4.2.11).Source: HelpScout #3451076687
Generated by bug-report-triage (ID: bug-report-triage_6aa88a9e391790.05456871)
selul commentedon Sep 15, 2026
Thanks for the detailed report. I reproduced this on 4.2.13 and can confirm the regression, the rollback, and the
optml_capture_at_shutdownworkaround.How I tested: Groovy Menu's auto-integration hooks
ob_start()oninit(priority 0) andob_get_clean()onshutdown(priority 0), then inserts the menu after<body>. I mirrored that in a small mu-plugin and fetched the front end uncached:init0 start order)optml_capture_at_shutdown→ falseTwo notes on the analysis, since they affect the fix:
init0 start, since we open ours ontemplate_redirect), the loop never touches it. What loses the menu there is the re-armed empty buffer: we capture and echo the page, then open a fresh buffer, and Groovy'sob_get_clean()grabs that empty one. Your trace shows our buffer at the bottom, so Groovy 2.6.5 may start later than the version I read, but both orderings break the same way.shutdownalso can't go past priority 1, where core'swp_ob_end_flush_all()would flush our buffer through the pass-through handler and skip optimization.Fix: we're adding a Groovy Menu compatibility that takes over its shutdown step. Groovy's own
shutdowncallback is unhooked and itsgroovy_menu_final_outputfilter is applied to the page we capture, before image replacement, so the menu is inserted regardless of buffer order and its images get optimized too. PR incoming.selul commentedon Sep 15, 2026
Fix is up in #1150 (targets
development).Until the next release ships, you can install the fixed build directly: download the plugin ZIP from the PR build, then go to
WP Admin → Plugins → Add New → Upload Plugin, upload it, and choose Replace current with uploaded when prompted. Your settings and connection are kept.rodica-andronache commentedon Sep 15, 2026
🤖 Automated QA Repro Steps
Since Optimole 4.2.12, sites running the Divi theme with Groovy Menu's auto-integration lose their header menu entirely on the front end — the menu markup never makes it into the page, only Groovy Menu's inline settings script does. It affects every front-end page, and rolling back to 4.2.11 brings the menu back.
Requires: Divi theme + Groovy Menu (premium) on a site where page caching can be bypassed.
Reproduce on Optimole 4.2.13:
gm-navbar.gm-navbarelement and no header menu on screen; only Groovy Menu's inline JS settings are present.gm-navbaris present exactly once, and the menu's logo/images are served from the Optimole CDN domain.Edge cases
add_filter( 'optml_capture_at_shutdown', '__return_false' );and reload — the menu must still appear exactly once (this path already worked before the fix and must not regress).Fix: #1150 (open)
pirate-bot commentedon Sep 17, 2026
QA agent — The Groovy buffer fix works in the matching public path; the proprietary Divi matrix remains unverified.
The candidate restored one visible Groovy menu and optimized its fixture images in Groovy Menu 1.4.5's matching init/shutdown buffer path, while the same fixture lost the menu on qa-base. Legacy capture mode, manual placement, and both logged-in and logged-out views also kept exactly one menu, and all five added unit tests passed. The exact Divi, Groovy Menu premium, WP Rocket, and SiteGround Optimizer combinations could not be assembled from available packages, so those product-specific journeys still need human QA.
Please still try
Lab notes (6 passed · 2 blocked)
Candidate codeinwp/optimole-wp b16784d; qa-base ac2459f. WordPress 7.1, PHP 8.2.33 for CLI and PHP-FPM, MariaDB 11.8.6, nginx, Twenty Twenty-Five 1.5. Installed built Optimole ZIP 4.2.13 and Groovy Menu free 1.4.5. Prepared an assigned gm_primary menu, real Groovy auto-integration, an uploaded PNG, auto and manual pages, and a query-scoped test mu-plugin for the documented legacy switch/manual-option states. Optimole connection and image replacement were seeded through Optml_Settings with a local test CDN key; this verifies URL replacement behavior, not a real customer account or live CDN delivery. PHPUnit 9.6.22 used the WordPress 7.1.0 test library.
Run
qa-agent_6aac02a6eea017.46174008.Full report, evidence and session trail
fix: insert Groovy Menu markup into the page captured at shutdown (#1150
pirate-bot commentedon Sep 21, 2026
🎉 This issue has been resolved in version 4.2.14 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀