TS\WonderfulRelations\System\ChildPlugin\Kernel is the default
loader for a child plugin. AbstractChildPlugin::install_plugin()
constructs it once wonderful_relations_plugin_loaded fires.
What the Kernel does
In its constructor it runs load_dependencies() and
register_shortcodes():
- Reads
<plugin>_db_versionoption and compares with the context version. If aDatabase/Config/config.jsonexists and the stored version is older, it sets$needs_update = true. - Loads the plugin textdomain. It registers the textdomain on the
load_wr_plugins_localesaction so multilingual sites pick up updated.mofiles in lock-step with the WR mother. - Boots resources — instantiates
Resourcesso the plugin’s stylesheets/scripts can register themselves. - Boots modules only if no DB update is pending. When an update is pending, modules are skipped to avoid crashes from removed DB columns. The Kernel logs a notice instead.
- Registers the admin menu. If
has_admin_menu()is true, the defaultMenuis instantiated (or the FQCN passed towith_menu_class()). - Registers
DatabaseUpdaterif a declarative DB config is present. This wires the Update Center AJAX endpoints. - Registers cron hooks. If the context has a
cron_registrar, the closure is added toinit. - Registers a
<slug>_versionshortcode that prints the plugin version. Useful for footers/about pages.
Update gating
The Kernel will not boot your modules while
AbstractChildPlugin::is_update_pending() is true. This is intentional:
modules typically read DB rows that may not exist on the old schema, so
running them before the user clicks “Run update” in the Update Center
would crash the site.
If the user lands on wp-admin/admin.php?page=<slug>-update, the
Update Center page itself still runs because the Menu always registers
the update submenu.
Replacing the Kernel
If you need extra boot logic (e.g. license auto-updater, plugin self-
registration with a remote service), subclass Kernel and pass the
FQCN through:
return ChildPluginContext::create( /* … */ )
->with_kernel_class( \TS\YourPlugin\YourKernel::class );Override boot_modules() or register_shortcodes(). Avoid replacing
the entire load_dependencies() flow unless you really need to —
inheriting and adding to it keeps update gating and cron registration
in sync with future WR releases.
