Question about the template-loader.php file

The conditional first checks against what gets returned from the template_include hook. In most cases, a template will be found, and there will be no issue. We’ll only move onto the 2nd conditional if template_include cannot find or cannot load the template. We then look at the WP_Theme object, which does some base-line checks to see if something is wrong with the theme. You can look at the linked WP_Theme object to see which errors can be generated, but it’s generally just making sure that the theme is reachable and readable. If something is critically wrong with the theme, it adds a notice to the object and displays it to the user to fix the error.

Do note that this error would only show up to a logged-in user with the switch themes capability (administrators by default). Presumably, they would know how to fix the error or escalate the issue to someone who does.

If there’s nothing wrong with the theme, it’s assumed to either be intentionally left out or user error ( i.e., bad filename or misspelling ). It would be unreasonable to check a file-directory for similarly named templates. It would be unreasonable to error out on a missing template if it were intentionally left out.