What is actually the correct way to boot Laravel with new acorn?
Because in docs it is wrapped in after_setup_theme action but in the sage repository it self it is without it before loading theme files (setup.php, filters.php)
I naturally followed the sage repository, but it has consequences of functions defined in theme files being non-existent for usage in ServiceProviders or any other class referenced in bootloader.
I also wanted to open a post myself about this but since this looks similar I will (for now) not open a new one.
Problem:
I noticed that using after_setup_theme to boot up the Acorn application, stuff like register_activation_hook etcetera are not working, with the assumption that these are happening earlier than after_setup_theme in the cycle of WordPress.
And when I don’t use the after_setup_theme , hooks like register_activation_hook are working but unfortunately later failures are happening i.e. in rest-api.php in wordpress/wp-includes where for example using $wp_rewrite->index_permalinks is null (see related error below):
Exception has occured.
Error: Call to a member function using_index_permalinks() on null.
What’s is the solution to this, to use after_theme_setup but still be able to have these hooks such as register_activation_hook available and usable.
When booting Acorn in a theme’s functions.php, you shouldn’t need after_setup_theme - but Acorn does expect functions like get_stylesheet_directory when booting.
example using $wp_rewrite->index_permalinks is null
You might have to try a lower hook priority or experiment around a bit yourself with finding a solution to this.