remove_action function

There are occasions using a child theme when you want to replace the original action with your own. WordPress provides a function for this:

 <?php remove_action( $tag, $function_to_remove, $priority, $accepted_args ); ?> 

However, if you are overriding a parent theme, then the action will not yet exist. I found this useful filter on WordPress Answers.

add_filter( 'the_content', 'unhook_custom_function', 11 );
function unhook_custom_function( $content ) {
  remove_action( 'some_hook', 'custom_function' );
  return $content;
}
Scroll to Top