I would like to override a require_once present at the beginning of the functions.php of my main theme through my child theme.

specifically I have:

require_once get_template_directory().'/libs/some-function.php

I know that replacing get_template_directory() with get_stylesheet_directory() I can load a modified copy of the some-function.php file into my child theme. but I wouldn't change the parent theme, I would make the change only in the child theme.

I add that the require_once is not hooked




1 Answer 1


No, the parent themes functions.php is always loaded, and require_once is not a WordPress API but a part of the PHP language itself

The only way to change it would be to modify the file

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.