Today I want to talk to you about unhooking actions and filters in wordpress and some common problems we face.
Write lets get on with it.
Some starter tips. Actions have to be hooked to hooks before do_action is fired. So, the following:
will not work. the action hasn’t been hooked and do_action digthis simply runs through all actions that have been hooked. The correct way is:
Please do note the above are examples hoping to clarify, Normally we hook actions in plugin or themes’ functions.php file. The same logic applies to removing the action, removing the action after it has been run is pointless you must do it before the action is run so.
So lets move on to our code into functions.php file
We have 2 files now one template file in our child theme called digthis.php which simply has do_action(‘digthis’);
So now we’ve successfully remove the function digthis_hello_world from digthis hook called in ‘digthis example template’.
In the next part of this series we will be covering how to remove filters and actions that have been defined within classes. And that’s it folks