Skip to content

🐛 Defer console boot to wp_loaded for complete WordPress bootstrap#509

Merged
retlehs merged 1 commit into
mainfrom
fix/scheduler-wordpress-bootstrap
Mar 8, 2026
Merged

🐛 Defer console boot to wp_loaded for complete WordPress bootstrap#509
retlehs merged 1 commit into
mainfrom
fix/scheduler-wordpress-bootstrap

Conversation

@retlehs

@retlehs retlehs commented Mar 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Defers bootConsole() to the wp_loaded action when WordPress hasn't fully loaded yet, instead of calling it immediately during after_setup_theme
  • When the scheduler spawns commands via the acorn binary, the mu-plugin/theme boots Acorn on after_setup_theme, which called bootConsole()exit() before wp-settings.php finished loading. This meant init and wp_loaded never fired, breaking anything that depends on them (custom post types, taxonomies, rewrite rules, etc.)

Reproduction

Created a test command that probes the WordPress bootstrap state, scheduled it via routes/console.php, and ran wp acorn schedule:run.

Before fix (scheduler spawning via acorn binary):

get_permalink(2): http://radicle.test/sample-page/

did_action(muplugins_loaded): 1
did_action(plugins_loaded): 1
did_action(setup_theme): 1
did_action(after_setup_theme): 1
did_action(init): 0
did_action(wp_loaded): 0

After fix (scheduler spawning via acorn binary):

get_permalink(2): http://radicle.test/sample-page/

did_action(muplugins_loaded): 1
did_action(plugins_loaded): 1
did_action(setup_theme): 1
did_action(after_setup_theme): 1
did_action(init): 1
did_action(wp_loaded): 1

Also verified wp acorn about, wp acorn route:list, wp acorn config:clear, and php vendor/roots/acorn/bin/acorn about all still work correctly with the fix applied.

Closes #383

🤖 Generated with Claude Code

Closes #383

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@retlehs retlehs merged commit 33c014f into main Mar 8, 2026
3 checks passed
@retlehs retlehs deleted the fix/scheduler-wordpress-bootstrap branch March 8, 2026 22:46
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.

Acorn scheduler is not loading wordpress correctly

1 participant