Per wordpress best practices, I created a child theme for an existing theme I have. Everything works fine until I try to add a template file which follows WP's template hierarchy conventions. For example, if I add category.php or archive.php, I get a white screen of death, and this is the error I get in Apache:

    [:error] [pid 2919] [client] PHP Warning:  include(): 
Failed opening '/home/www-dev/beokinawa/wp-content/themes/x-child/index.php' for
 inclusion (include_path='.:/usr/share/php') in /home/www-dev/beokinawa/wp-
includes/template-loader.php on line 74, referer: 

Whenever I try to view a category after uploading either of those files, the system wants to load the category edit screen url it seems. What could cause that? You can also see from the error that it's trying to find index.php, the last in the template hierarchy. If category.php or archive.php are present then there would be no reason for it to look for that file, right?

That the issue would be permissions is interesting. Here is a breakdown of permissions.

  • files are chown'ed user:www-root
  • per wordpress documentation, files are 664 ( even changed the directory and files to 777 briefly, but that didn't work either)

It seems I cannot add any additional files from the wordpress template hierarchy scheme. But, editing template parts is fine. The parent theme comes with wp-header.php, wp-footer.php, etc, and I can add those and overrides happen correctly.

  • that sounds like it can't find the file or maybe the permissions are wrong...did you confirm the file is there and set permissions? I like them to be 644
    – rudtek
    Mar 15, 2017 at 22:59
  • @rudtek thanks for the insight. I'm adjusting permissions now. I updated the post to reflect some of my settings.
    – user658182
    Mar 16, 2017 at 12:51

1 Answer 1


Your initial idea is correct, WordPress shouldn't look for index.php if it finds category.php for a category archive. However, that may change if you don't have file permission and ownership set properly, or if FileSystem cache is messing with file_exists() check.

Follow these steps:

  1. Make sure your child theme files are readable by the web server user. Check both file permission and ownership.

  2. Check to see if the child theme is coupled properly with the parent theme and it can get templates from parent theme if any specific template is absent in the child theme.

  3. In wp-config.php use clearstatcache(); function (before require_once(ABSPATH . 'wp-settings.php');) to clear filesystem cache.

    In case you were adding & removing those files while testing and filesystem caching those files, clearstatcache(); will help you clearing those filesystem cache that may confuse WordPress core. Once done, remove clearstatcache(); call.

  • Thanks for the answer. Added a few more details that may shed some light on things.
    – user658182
    Mar 16, 2017 at 12:48

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.