There is a header.php for the theme and it is present in the theme folder. Still no closer to finding the cause of this.
I’ve done some more testing, and I don’t get the error when viewing the dashboard or when using a different theme. Further, disabling all widgets doesn’t help so it’s definitely a theme problem.
The question is – where and what?
Checking the logs again – if I visit
https://***/blog/wp-content/themes/kwpo/index.php
directly, I get a 500 browser error and the same message in the log.
When I view the blog normally, I get the error as posted in the OP BUT it has
referer: https://****/blog/
on the end of it.
So, it seems for some reason somewhere in the template is trying to call the theme’s index.php directly. Even more strangely, the log file shows the client address as my remote IP so the request is from my browser rather than from the server.
UPDATE:
Culprit found. After discovering the above, I figured it must be a separate request from the browser causing the error in the logs (since the page renders fine) – looking at the console in Chrome I found a “resource not loaded” error (with an HTTP/500 response) – BINGO!
Found this line in the header:
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>" type="text/css" media="screen" title="no title" charset="utf-8"/>
Which is trying to load the url
https://****/blog/wp-content/themes/kwpo
as a stylesheet. This is then loading the index.php for the theme directly, and of course none of the WP functions are defined when it’s accessed directly hence the error in the logs.
Checking the theme source, this line is also present in the demo site for the theme so it’s just a bug in the theme’s header.php
Removing the above line has fixed the problem.