-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor: Load ETK common code before the plugins_loaded
action
#51158
Conversation
`common/index.php` contains helper functions that would be useful when other ETK modules are being setup during the `plugins_loaded` action. Unfortunately they can't be used though, because those helper functions are defined as part of `plugins_loaded` too. There's nothing in `common/index.php` that means loading it should be delayed. So moving the `require_once` call so that it gets loaded as soon as `full-site-editing-plugin.php` is loaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes perfect sense to me, and it tests well. It doesn't really make a difference on JS/CSS loading order either, since those still use normal hooks.
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
😎 thanks @noahtallen |
That's super cool, I don't think I'd considered that workflow. But it's really nice that it works 😎 |
@p-jackson Just a lil heads up that it's |
Changes proposed in this Pull Request
common/index.php
contains helper functions that would be useful when other ETK modules are being setup during theplugins_loaded
action. Unfortunately they can't be used though, because those helper functions are defined as part ofplugins_loaded
too.There's nothing in
common/index.php
that means loading it should be delayed. So moving therequire_once
call so that it gets loaded as soon asfull-site-editing-plugin.php
is loaded.Context: as part of #51122 I want to be able to call
get_iso_639_locale()
duringStarter_Page_Templates
's__construct()
, so I want to guarantee thatget_iso_639_locale()
gets defined first.Testing instructions
install-plugin.php etk update/etk-load-common-code-earlier
hide-plugin-buttons-mobile.css
in the network tab)