Hooks in WordPress allow you to change or add code without editing core files. They are used extensively throughout WordPress and Blog2Social and are very useful for developers.
There are two types of hook: actions and filters:
- Action Hooks allow you to insert custom code at various points (wherever the hook is run).
- Filter Hooks allow you to manipulate and return a variable which it passes.
Using hooks
If you use a hook to add or manipulate code, you can add your custom code to your theme’s functions.php file.
Using action hooks
To execute your own code, you hook in by using the action hook “do_action(‘action_name’);”.
Here is where to place your code: