I have copied a function from a plugin because I intend to run the same function with some minor changes. So, to prevent the plugin function running and also mine, I am trying to disable the plugins function.

Plugin function code

/* new product */
function um_activity_new_woo_product( $post_id ) {
add_action('save_post', 'um_activity_new_woo_product', 99999, 1 );

I thought to try the below, but has not stopped the function from running:
add_filter( 'um_activity_new_woo_product', '__return_false' );

Any ideas or changes to try?


You can use remove_action() to remove a function from a specified action hook. Documentation

remove_action( string $tag, callable $function_to_remove, int $priority = 10 )

This function removes a function attached to a specified action hook. This method can be used to remove default functions attached to a specific filter hook and possibly replace them with a substitute.

So in your case,

// Remove the function from 'save_post' action
remove_action('save_post', 'um_activity_new_woo_product', 99999 );

// Add your own function my_activity_new_woo_product(), to 'save_post' action
add_action('save_post', 'my_activity_new_woo_product', 99999, 1 );

I hope this may help.

  • +1, but see this: hakre.wordpress.com/2010/08/09/… – Stephan Samuel May 3 at 17:26
  • The shared link is about 8 years old. Much have changed since 2010. You may give a try to solution. – Qaisar Feroz May 3 at 17:32
  • @StephanSamuel let me know if it works. – Qaisar Feroz May 4 at 8:21
  • 1
    Old or not, some of the content of the article is still relevant. Your solution works sometimes. In general, it is correct (hence the +1) but there are cases when it would not work. The OP may be the best person to answer if the solution worked in their case. – Stephan Samuel May 5 at 17:36
  • @StephanSamuel sorry for my mistake of wrongly tagging you instead of OP. Based on your 1st comment, I wanted to ask the author of OP to let me know if it worked or not. – Qaisar Feroz May 5 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.