Consider adding to all theme php files: if (!defined('ABSPATH')) { exit; }
I'm seeing a lot of PHP error logs triggered by bots who are directly accessing theme folders or files (such as /wp-content/themes/betheme/index.php).
When accessed, the pages fail to load and produce an error such as:
PHP Fatal error:
Uncaught Error: Call to undefined function get_header() in
/home/vhosts/domain.com/httpdocs/wp-content/themes/betheme/index.php:10
Uncaught Error: Call to undefined function get_header() in
/home/vhosts/domain.com/httpdocs/wp-content/themes/betheme/index.php:10
Might I suggest that you add a line of code to all PHP files to prevent access outwith WordPress?
It's just good security practice.
if (!defined('ABSPATH')) { exit; }
Comments
And it is good practice to make theme files inaccessible from outwith WordPress.
It has no bearing on the WordPress version and reinstalling will not fix it.
If you look at the PHP warning, it is logging an error as get_header() is not defined.
It is not defined since a bot is accessing it directly.
Checking if ABSPATH is defined ensures the theme files are being loaded by WordPress and not accessed directly.
Please reconsider and add this single line to the php files in the theme... index.php at the very least.
The error has nothing to do with WordPress itself, it is being triggered by direct access to the theme index.php file.
Reinstalling WordPress will not solve the issue. Only checking if WordPress is loaded in index.php will solve it.
Notice!
Please attach a link to this forum discussion.
Thanks
A bot is directly accessing the theme index.php file outside of WordPress.
You can replicate it yourself with php warnings on and access /wp-content/themes/betheme/index.php in the browser.
Check your logs to see why, it will more than likely be the "get_header() is not defined"
We want to help you, but we will not change our core files just for this. Nobody ever had this problem in the past, so we suggest you take a look at your hosting environment. The 500 error pops up when there are security or permission problems. Thus the index.php will not get opened.
Furthermore, we are not willing to change anything in the theme files currently so you would have to change it for your installation if you have problems with it.
What you ask for, requires files customization what in reference to Item Support Policy is not allowed. So if you want to modify files and don't know how, you should contact your web developer. Item Policy says: Item support does not include services to modify or extend the item beyond the original features, style, and functionality described on the item page. For customization services that will help you tailor the item to your specific requirements, we recommend contacting the author to see if they privately offer paid customisation services or checking out the great service providers on Envato Studio thanks