- Hooks are pieces of code, that interact or modify another piece of code at predefined spot.
- They are foundation of how plugins and themes interact with WP Core and are also used by WP Core.
- There are two hook types: Actions and Filters
- To use a hook, you need to write a custom function called Callback.
Callback needs to be registered with hook for specific action or filter.
- Actions allow adding data or changing how WP operates (return output to the user or insert something into the database).
- Filters allow changing data during execution of WP Core, plugins and themes. Filters accept variable, modify it and return it.
They should never affect global variables and output.
Source: