I want to know if I can override a function which is present into the parent theme function.

If I redeclare the function into the child theme I am getting function already exist error.

So Please guide me how can I define the function with same name in my child theme's functions.php

2 Answers 2


Check the parent theme's functions.php. If properly written to support child themes, each of these functions should be wrapped in a conditional as follows:

if ( ! function_exists( 'theme_setup' ) ) :
function theme_setup() {
   // Parent Theme Setup Function Code
add_action( 'after_theme_setup', 'theme_setup' );

What this does is when the parent theme's functions.php loads after your child theme, it will first check and see if your child theme already declared the function. If it has not, then it will go ahead and define it. Otherwise it will skip the function declaration and move on.

Just remember if you have to manually put these wrappers in, an update to the parent theme will overwrite them.


If you get an error when setting up a function with the same name as in your parent theme then the theme is not prepared for child themes properly. They have to be wrapped with a if ( !functions_exists('...') ) check otherwise it won't work out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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