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.

Changing execution order with priorities

Changing execution order with priorities - WordPress Tutorial

From the course: WordPress: Action and Filter Hooks

Start my 1-month free trial

Changing execution order with priorities

- [Instructor] When adding actions and filters WordPress provides a way for us to specify both priority and arguments. These are two important concepts to understand so I'm going to spend a little time on both. Let's start with priorities. You know when you call into a support desk and get put on hold and then some recorded voice says, "Calls will be answered in the order that they were received." Well procedural code works in that same way. It's executed in the order that it's written. Priorities are a way that we can go in and change the order of things when it comes to action-hooks and filters. To illustrate this I want to highlight four specific functions that utilize priorities. Certainly other functions do too, but these are the ones I want to point out. We've got add_filter, remove_filter, add_action, and remove_action. If we start with the documentation for add_filter, part of the instructions for using it…

Contents