Search for Resources and Solutions

Midrub Hooks Introduction

Midrub has hooks support since the version 0.0.7.0 and them are important to clear the database, execute code together with other code and assure good work of the Midrub's features. 

To register a new hook:

add_hook(

'first parameter is a string with hook id',

function ($args) {

// $args contains an array with hook parameters

}

);

To execute the hook:

run_hook(

'first parameter is a string with hook id',

'second parameter is an array with hook parameters'

);


To be clear, when is called run_hook in the second parameter are added the important parameters(user_id, network_id or other important parameter).

add_hook should be called from the method's load_hooks(apps, components, plugins, themes).

Was this article helpful?