Hooks

Hooks are a way for one piece of code to interact/modify another piece of code.

There are two types of hooks: Actions and Filters. To use either, you need to write a custom function known as a Callback, and then register it with Mailwizz hook for a specific Action or Filter.

Actions allow you to add data or change how Mailwizz operates. Callback functions for Actions will run at a specific point in in the execution of Mailwizz, and can perform some kind of a task, like echoing output to the user or inserting something into the database.

Filters give you the ability to change data during the execution of Mailwizz. Callback functions for Filters will accept a variable, modify it, and return it. They are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output.

Mailwizz provides many hooks that you can use, but you can also create your own so that other developers can extend and modify the code base.

Was this article helpful?

Related Articles