How to override existing plugin action with new action

You can use the remove_action() function, like this:

remove_action('publish_post', 'old_action');
add_action('publish_post', 'new_action');

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.

Leave a Comment