Access all of Typerocket. Get Pro.
WordPress Hooks
( v6 )
- # About Hooks
- # Actions
- # typerocket_loaded
- # typerocket_before_load
- # typerocket_model
- # typerocket_after_routes
- # typerocket_kernel
- # Filters
- # typerocket_middleware
- # typerocket_extensions
About Hooks
TypeRocket comes with several hooks to help you extend its core functionality. Not all the hooks are listed here.
Actions
typerocket_loaded
The typerocket_loaded
hook runs during after_setup_theme
, after TypeRocket core has loaded, and before the TypeRocket registry runs. This hook allows WordPress plugins to interact with TypeRocket.
add_action('typerocket_loaded', function() {
// do stuff
});
typerocket_before_load
You can also use typerocket_before_load
if you want to run code before the TypeRocket system is loaded.
add_action('typerocket_before_load', function() {
// do stuff
});
typerocket_model
The typerocket_model
action hook runs after a model is constructed.
add_action('typerocket_model', function($model) {
// do stuff
});
typerocket_after_routes
The typerocket_after_routes
action hook runs after the TypeRocket public.php
route file is loaded.
add_action('typerocket_after_routes', function() {
// do stuff
});
typerocket_kernel
The typerocket_kernel
action hook runs when TypeRocket\Http\HttpKernel
is instantiated.
add_action('typerocket_kernel', function($kernel) {
// do stuff
});
Filters
typerocket_middleware
Return the middleware stack for the current hook call or REST API request.
add_filter('typerocket_middleware', function($middleware, $globalGroup) {
return $middleware;
}, 10, 2);
typerocket_extensions
Modify the plugins that should be loaded.
add_filter('typerocket_extensions', function($extensions){
return $extensions;
});
Found a typo? Something is wrong in this documentation? Fork and edit it!