We’re currently developing an acorn package using the roots/acorn-example-package template. This package is used in a Bedrock and Sage WordPress setup.
I’m currently having the issue that Acorn is initialized when the theme is loaded by WordPress, as Sage boots Acorn in the functions.php
with \Roots\bootloader()->boot();
. Is there a possibility to boot acorn sooner, for example when mu-plugins are loaded to be able use earlier WordPress hooks?
Reading the docs on booting acorn, the example that is suggested for usage in own themes or plugins is using the after_setup_theme
hook which would suggest that acorn can’t be booted earlier, even though it’s installed as a composer dependency at Bedrock level.
I tried to move the \Roots\bootloader()->boot();
part to a custom mu-plugin, but multiple issues occur (auto-discovery of providers fail, ConstantAlreadyDefinedException
, …)
Is this a limitation for acorn?
Yeah. Acorn requires the theme be available during boot since functions like get_theme_file_path()
are used when attempting to infer a default base path, package discovery, etc.
2 Likes