From the course: WordPress: Action and Filter Hooks

Unlock the full course today

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

Using apply_filters

Using apply_filters - WordPress Tutorial

From the course: WordPress: Action and Filter Hooks

Start my 1-month free trial

Using apply_filters

- [Instructor] Whenever you come across apply_filters in a code base, what it's doing is calling any functions that have been added to a particular filter hook. It takes a few parameters. The first is tag, which is the name of the filter hook. And then we've got this mixed value. That sounds kind of weird, but lets look at what that is. The value is the name of the callback function and then this second one here, args, are any additional arguments that we want to be able to pass back into our callback function. So let's see how this plays out in this little example here. So we'll start with apply_filters. Then we've got the name of the filter hook, in this case example_filter; the value that we want to filter, filter me; and then a couple of arguments here that get passed back to our example_callback function. So this callback_function, first we've got the string, which is the value we want the filter, filter me, and then…

Contents