A new hook system has been added to CodeIgniter. Because it is exacly like WordPress, re-writing a whole documentation for it would be silly. This is why we invite you to read about it on WordPress Codex. You will find below a list of available hooks system functions, with links to WordPress documentation to learn more about it.

How To Use

All you have to do is implement actions and filters as you develop your applications. Once that done, plugins and themes, or even applications files (libraries, controller, helpers) can use them to do whatever they are made to do. Here is an example of how to use theme.

# Let's suppose I have an array of data that I want to 
# let themes/plugins/files to do anything to it. All I 
# have to do is to pass it to the filter :).
$array = array(
    'one'   => 'Un',
    'two'   => 'Deux',
    'three' => 'Trois',

# Then:
$array = apply_filters('custom_filter', $array); # That' all.

Then, when developing your application, tell your themes or plugins developers about the custom_filter and what it takes as argument (array), so when they are developing their things, they only need to do like so:

add_filter('custom_filter', function($array) {

    # They do whatever they want with it, then return it.

    return $array; # <- This should always be returned.


The same thing goes with actions, except than they often take no arguments and return nothing (not always).

# Register the hook within the application:

# After telling developers about it, they can do :
add_action('custom_action', function() {
    # Whatever they want.

Available Hooks

Here is a list of function you may use: