WordPress Hooks: ACTION and FILTERS
Hooks are simply a standardized way of “hooking” into WordPress. Using hooks, we can execute functions at specific times in the WordPress process, allowing us to alter how WordPress functions and the expected output. Hooks are the primary way plugins interact with our content in WordPress.
Two types of hooks can be used: Actions and Filters. Action hooks are triggered by events in WordPress.
For example, an Action hook is triggered when a new post is published.
Filter hooks are used to modify WordPress content before saving it to the database or displaying it to the screen. For example, a Filter hook is available for the content of the post or page.
This means we can alter that content after it is retrieved from the database, but before it is displayed in our browser.
add_action('hook_name', 'your_function_name',priority, arguments);
add_filter('filter_name', 'your_function_name',priority, arguments);