Recall & Review
beginner
What is the purpose of hook priority in WordPress?
Hook priority controls the order in which functions attached to the same hook run. Lower numbers run first, higher numbers run later.
Click to reveal answer
beginner
How do you specify the priority of a function attached to a WordPress hook?
You specify priority as the third argument in add_action() or add_filter(). For example: add_action('init', 'my_function', 10); where 10 is the priority.
Click to reveal answer
intermediate
What does the 'accepted_args' parameter do in add_action() or add_filter()?
It tells WordPress how many arguments your hooked function can accept from the hook. This is the fourth argument in add_action() or add_filter().
Click to reveal answer
intermediate
If two functions are hooked to the same action with the same priority, which one runs first?
They run in the order they were added. The function added first runs first.
Click to reveal answer
beginner
Why might you want to change the priority of a hooked function?
To control when your function runs relative to others. For example, to run before or after another function hooked to the same action or filter.
Click to reveal answer
What is the default priority if you don't specify one in add_action()?
✗ Incorrect
The default priority in WordPress hooks is 10 if you don't specify it.
Which argument number in add_filter() sets how many arguments your function accepts?
✗ Incorrect
The 4th argument in add_filter() or add_action() sets the number of accepted arguments.
If you want your function to run after all others hooked to the same action, what should you do?
✗ Incorrect
Higher priority numbers run later, so use a higher number to run after others.
What happens if your hooked function accepts fewer arguments than the hook provides?
✗ Incorrect
Your function will ignore extra arguments it does not accept.
How do you hook a function to run with priority 5 and accept 2 arguments?
✗ Incorrect
The third argument is priority (5), the fourth is accepted args (2).
Explain how hook priority affects the order of function execution in WordPress hooks.
Think about how you decide who goes first in a line.
You got /4 concepts.
Describe how to control the number of arguments your hooked function receives and why it matters.
Consider how many pieces of information your function needs.
You got /4 concepts.