Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
The remove_action Function1:15 with Zac Gordon
In this video we look at the remove_action function, which is used to unhook functions from existing action hooks.
Remove action, works very similarly to remove filter.
If we take a look at an example, we can see that we can take the custom function
that we created in the last example under, add action, example.
Where we were taking our custom Google font and adding it on to the W,
P and Q scripts hook.
And, with remove action, we could simply remove it again.
You could apply this to any hook that's native to WordPress, as well as
any third-party one, so if you see things that are being added in plug-ins,
that you need to override, this is how you would do it.
I do wanna mention, though,
that there is something else called remove_all_actions and remove_all_filters.
What this will allow us to do, is in one fell swoop, remove all of
the hooked-in functions that are tied in to a particular filter or action.
We could also use the optional priority parameter,
if we wanna say just remove all actions with priority of x.
Maybe it's ten, maybe it's one, et cetera.
So it is helpful to know that you do have these two helper functions that
remove all actions, as well as remove all filters.
In addition to the singular one
You need to sign up for Treehouse in order to download course files.Sign up