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 License Manager & Enwikuna License Manager Pro 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 License Manager or Enwikuna License Manager Pro plugin. This also guarantees that individual customizations are not overwritten when Enwikuna License Manager & Enwikuna License Manager Pro gets updated. Hooks are used extensively in WordPress, Enwikuna License Manager & Enwikuna License Manager Pro, 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 License Manager & Enwikuna License Manager Pro 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:
- Within the functions.php file of a custom child theme
- With a plugin such as Code Snippets
Use action hooks
To run your own code at a specific location inside Enwikuna License Manager or Enwikuna License Manager Pro, 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 inside Enwikuna License Manager or Enwikuna License Manager Pro! A return value is not possible. A return value is not possible.
Use filter hooks
To adjust values through your code at a specific location inside Enwikuna License Manager or Enwikuna License Manager Pro, 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.