What is a Filter?
Filters are a type of “hook” in WordPress. Hooks are built-in functions that enable pieces of code to interact with one another. Filters enable you to modify data while running plugins and themes.
More About Filters
Filters are a key component in web development. They’re one of two types of hooks in WordPress, the other being “actions.”
The goal of filters is to modify data from WordPress core, themes, and plugins using functions. Unlike actions, filters shouldn’t affect global variables on your website.
To add a filter, you need to create a callback function that will run when the filter runs. This callback function needs to be part of a hook that will call it.
There are additional parameters that you can use with WordPress filters. To learn more about filter parameters, we recommend that you check out the official WordPress Developer Handbook.