• If the functions file of a parent theme has required files such as this:

    require get_template_directory() . '/inc/custom-header.php';

    Is there a way to prevent these files from loading from within the child theme?

    From what I have found, it doesn’t seem possible. At least not in the past. But maybe someone has some new ideas? Or will the files load no matter what, in which case letting the file load and using remove_action will be the best option?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Is there a way to prevent these files from loading from within the child theme?

    Not that I’ve come across and, fwiw, I also think it’s a lousy way to code a theme. It should be require get_stylesheet_directory() . '/inc/custom-header.php'; at the very least.

    All I can suggest is that you make this point to the theme’s author in the hopes that they will update the theme to make it more child-theme-friendly.

    Thread Starter slacle

    (@slacle)

    The theme is based on underscores actually. And this part comes from the underscores original set up. So maybe that’s why it was done that way since underscores wasn’t meant to be used as a parent theme.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘overriding or removing required files in functions.php from child theme’ is closed to new replies.