From the course: WordPress: Action and Filter Hooks

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Filters explained

Filters explained - WordPress Tutorial

From the course: WordPress: Action and Filter Hooks

Start my 1-month free trial

Filters explained

- [Carrie] If we go back to our login page example here, think of filters as sitting between the database and a browser. So before data from the database hits this page, you could use a filter to change it. Likewise, before data from this page is processed, or written to the database, you could use a filter to change that. WordPress has a set of filter functions that you'll see look kind of similar in format to those actions functions. We've got has_filter, that checks to see if any filters have been registered for a hook. We've got add_filter that lets us hook into a specific filter. And then we've got this one here, apply_filters. This calls all functions registered on a particular filter hook. Apply_filters is sort of the filters version of this do_action function. Just as we saw with actions, we've got this huge filter reference, where WordPress lets us hop in and modify data before it's returned. There's one…

Contents