I’m using a plugin. It has an action like this.
add_action('publish_post', 'old_action');
function old_action($pid) {
"code goes here"
}
}
I’m writing a module for this plugin. So i need to override that old action function with my new action function.
This is my new function.
function new_action($pid) {
"code goes here"
}
}
I want to replace that old_action function with my new_action function using hooks. Can anyone help me?
Thanks
You can use the
remove_action()
function, like this:It’s important to note that if the old_action was added with a priority parameter, you must add that to the
remove_action
call, otherwise it will fail to remove it. There are other implications if the old_action was added within a class. See here for more info.