Extend Enwikuna Helper

Note: This is developer level documentation. Within the scope of our support policy, we cannot provide support for customizations unless they have been ordered through us. If you are not familiar with code / hooks and how to resolve possible conflicts, contact us for help.

Overview

To help you extend Enwikuna Helper at important places, we offer several hooks. Hooks within WordPress essentially allow you to change or add code without having to edit the files inside the Enwikuna Helper plugin. This also guarantees that individual customizations are not overwritten when Enwikuna Helper gets updated. Hooks are used extensively in WordPress & Enwikuna Helper making them very useful for developers.

There are two types of hooks: Actions & Filters

  • Action hooks allow you to insert custom code in various places (wherever the hook is executed)
  • Filter hooks allow you to manipulate and return passed variables and their values (e.g. a list of functions)

A list of all hooks offered by Enwikuna Helper can be found here.

If necessary, we can add appropriate hooks. Just talk to us about it.


How to use hooks

If you want to use a hook to add or edit code, you can add your custom code in several ways:


Use action hooks

To run your own code at a specific location inside Enwikuna Helper, you must use an action hook (do_action):

add_action( 'action_name', 'action_name_action' );
function action_name_action() {
    // Your code
}

Note: An action hook is only meant to execute code at a specific location in Enwikuna Helper! A return value is not possible.


Use filter hooks

To adjust values through your code at a specific location inside Enwikuna Helper, you must use a filter hook (apply_filters):

add_filter( 'filter_name', 'filter_filter_name' );
function filter_filter_name( $variable ) {
    // Your code
    return $variable;
}

Note: A filter hook must always return a value, which must be of the same type as the passed type of the 1st attribute.