I have added if ( ! function_exists ( 'event_meta_box' ) ) { to my child theme functions.php along with the existing function and my changes.

When loading the site I get the following error Fatal error: Cannot redeclare event_meta_box() (previously declared in /home/user/public_html/folder/wp-content/themes/theme-child/functions.php:10) in /home/user/public_html/folder/wp-content/themes/theme/include/functions-new.php on line 3920

How is this fixed?

  • 2
    this is just a comment on why you get the error, not a solution: functions.php of your child theme gets loaded first, and the /include/functions-new.php of your theme gets loaded sometime after. therefore your function event_meta_box gets defined first, and when your theme tries to define that same function (again) it triggers the error. To have this work, your parent theme would need to have the ! function_exits code codex.wordpress.org/Pluggable_Functions
    – Michael
    Sep 26, 2018 at 20:11
  • The code originally comes from the Parent theme. I added it to the child functions.php then this error says. The error makes it look like the other way for some reason Sep 26, 2018 at 20:14
  • what theme are you using, and have you contacted the theme's developers for help?
    – Michael
    Sep 26, 2018 at 20:33

1 Answer 1


The child theme functions.php is actually loaded first (this is intentional and desired behaviour.) So despite the function_exists check in your child theme, it will achieve nothing, as it seems the parent theme does not have this wrapper and is loaded second, so a fatal error occurs.

There is no easy way to override a parent theme function (if it hasn't made all of it's functions pluggable by default - mine does but few do!) Sometimes the parent theme function is hooked to an action, and you can remove the function from the hook (using remove_action) and then then add your own custom function (using add_action). Other times (even more rarely) there is a filter available in the existing theme code.

Other that that you will have to get more creative by copying the relevant parent theme template(s) to your child theme and modifying it/them to change the function called to your custom one, or hook that is fired - as child theme templates are used instead of parent theme ones. But remember, both child and parent functions.php are loaded.

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.