I'm curious if other PHP code files besides functions.php, WP template files and style.css in a child theme actually override the same file in a parent them?

I am working with a client that has a theme with child theme support, however, there are no hooks or actions to unload for the functions that I wish to override. Looking for a clean way to perform this override whith customized code that won't be overwrote on upgrade.

2 Answers 2


It depends entirely on a) what functions and template files you're talking about, and b) how those functions are defined, or template files are called, in the Parent Theme.

If the Parent Theme uses get_template_part(), then you're golden. If the Parent Theme uses get_stylesheet_directory_uri() or STYLESHEETPATH, then you can override, with caveats. If the Parent Theme uses get_template_directory_uri() or TEMPLATEPATH, then you're going to have a difficult time.

With functions, if the Parent Theme wraps the functions in a function_exists() conditional, then you can simply override such functions by declaring them in the Child Theme. With hooks, you can simply remove_action or remove_filter.


Normally all files are "override"-able (but not the functions.php file). Rule is: child-Theme loads first, then the parent theme.

If you want to override a function inside the functions.php file, then it should be wrapped in

if ( ! function_exists('some_function_name') ) { 
    function some_function_name() { /* do stuff */ }

Else, it's not possible.

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.