This week I was struggling a bit customizing an exsisting theme for a client. To prevent the theme from being overwritten each update I created a child theme. This allowed me to cusomize most of the files that handled templating. The function which loaded additional stylesheets and js libraries was pluggable and could be overwritten.

The biggest problem I faced was to overwrite some of the core functions of the theme. These were not pluggable (did not use the if(!function_exsisits()) statement) and didn't use a hook or filter. Calling the same core function from the child theme functions.php or a custom plugin threw a fatal error (function cannot be redeclared).

1 Answer 1


My solution to this issue was to create a custom plugin with copies of the core functions needed to be overwritten. I gave these functions custom names so I could call them from the template files in the Child Theme directory. Now I could add my own code and modifications and leave files with the core theme functions intact.

This creates some redundant code, but now I can use a child theme and 'overwrite' core theme functions until the theme author makes the original core functions pluggable.

  • You could have just written those functions into the theme's functions.php and avoid the plugin, but otherwise this was about all yo can do except fork the theme maybe.
    – s_ha_dum
    Dec 19, 2015 at 15:00
  • There are quite some functions that need customizing. The functions themselves are pretty big (1500 lines of code each). With a plugin I can keep the functions in seperate files in one folder and include them in the main plugin file. This could also be achieved by creating an /inc folder in the child-theme root, but this felt a bit more clear for me.
    – SdeWijs
    Dec 19, 2015 at 15:37

Your Answer

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

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