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;

About Antonia Whitaker

An administrative, sales and marketing background has given me an understanding of what users want from their website. I do not confuse issues with technical jargon and I listen to what people want.

11. December 2013 by Antonia Whitaker
Categories: Wordpress | Tags: | Leave a comment

Leave a Reply

Required fields are marked *