How to override functions.php in child theme?

When a function is hooked, it is easy to change that in a child theme. What you need to do is

  • Remove the original call back function

  • Copy the function to your child theme and rename it.

  • Do your customizations as needed

  • Rehook your call back function

You can try the following:

// Remove the callback function from the hook
remove_action( 'after_setup_theme', 'mytheme_setup' );

// Copy the function, rename and do what you need
function my_new_callback()
{
    // Modify what you need
}

// Rehook your custom callback
add_action( 'after_setup_theme', 'my_new_callback' );

Leave a Comment