Skip to content

⚡ Bolt: Defer heavy theme check and extension loading to plugins_loaded#63

Open
mdjwel wants to merge 1 commit into
mainfrom
bolt-optimize-init-loading-17991864568001082086
Open

⚡ Bolt: Defer heavy theme check and extension loading to plugins_loaded#63
mdjwel wants to merge 1 commit into
mainfrom
bolt-optimize-init-loading-17991864568001082086

Conversation

@mdjwel
Copy link
Copy Markdown
Contributor

@mdjwel mdjwel commented Feb 2, 2026

💡 What: Deferred the loading of Heading_Highlighted and Features_Badge extensions and the wp_get_theme() call from the plugin constructor to the plugins_loaded hook.
🎯 Why: wp_get_theme() is a relatively expensive operation that was running unconditionally on every request during plugin load (before plugins_loaded). This forced WordPress to initialize the theme subsystem earlier than necessary.
📊 Impact: Reduced bootstrap overhead on every request. Additionally, the extension files are now only parsed if their specific features are enabled, further reducing memory and CPU usage for users with these features disabled.
🔬 Measurement: Verified with a script that wp_get_theme() is no longer called during the plugin file load.


PR created automatically by Jules for task 17991864568001082086 started by @mdjwel

…n loading

- Removed `wp_get_theme()` call from `core_includes` (called in `__construct`), which was forcing early theme initialization on every request.
- Moved `Heading_Highlighted.php` and `Features_Badge.php` inclusion to `init_plugin` (hooked to `plugins_loaded`), where `wp_get_theme()` is safely called.
- Added lazy loading for these extensions: they are now only required if the specific feature is enabled in options, in addition to the existing premium/theme checks.
- Preserved all existing logic regarding premium/theme restrictions.

Co-authored-by: mdjwel <12756152+mdjwel@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant