I'm looking for a way to execute some code before the whole system loads, more precisely right before plugins are loaded/executed.

Use case

I want to instanciate a custom object, that I need to interact with in my plugin, but I cannot declare it INSIDE my plugin. This object should actually be available in all plugins if needed.

Where should I put such code so it is reusable ? Thanks a lot !

1 Answer 1


You could put that code in index.php, before the require_once line. That’s about as early in the request as you can get ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.