Having your WordPress website crash due to a critical or fatal error can be a nightmare. Most of the time, it is caused by a malfunctionining plugin, theme, script or code on your website.
We’ll teach you some ways you can pinpoint this issue on you WordPress website.
- Enable debugging
- Disable plugins
- Activate default theme
- Enable PHP errors and view log
- Track errors at the host/server
Enabling debugging on your WordPress website may help locate the cause of the error. This will require you to edit the wp-config.php in the root directory of your WordPress installation.
If you’re using a web host, you can usually access the files using a File Manager within the dashboard. Within the wp-config.php file, find the following line and change false to true:
define( ‘WP_DEBUG’, false );
define( ‘WP_DEBUG’, true);
Once you do this, visit your website again. If the cause of the errors are caused by a malfunctioning plugin or theme, you will see a directory near the end of the error. If it includes one of the following directory paths at the end of the line:
…the cause is possibly the plugin or theme in the line. If this is the case, the following steps on disabling plugins or activating a default theme can further help you troubleshoot.
Disabling plugins can usually clear out any errors caused by them. You can disable them by renaming the plugins folder. If you’re web host has a File Manager, go into the wp-content folder and rename the plugins folder to plugins.backup. Doing this will deactivate any activate plugins in your website. If you’re website now loads as normal, a plugin is the issue. Troubleshoot with debugging to see if you can find out the specific one causing issues. This way, you can delete just the one having issues without having to re-install plugins one by one.
Activate default theme
When first installing WordPress, your setup may already include preinstalled themes by WordPress. If not, you can download it from https://wordpress.org/themes/author/wordpressdotorg/ and then export this file in the wp-content/themes folder.
This will require you to access the database. Edit “wp_options” table (or a table ending in _options if you have a custom prefix) and editing the template and stylesheet columns. Edit this value to have the exact name of your default theme, such as twentytwentytwo.
Enable PHP errors and view log
WordPress runs on PHP, a scripting language used commonly in web development. If you have access to the files of your installation, you can add the following code to the .php.ini or .user.ini.
If this file does not exist, you may be able to enable this by checking for an option within your host’s file manager for viewing hidden files or creating a new file with either name to include the line:
Try to reload the page to see if an error is now displayed. Depending on if the error displayed is from a theme or plugin, you may be able to try one of the steps above to troubleshoot further.
Track errors at the host/server
Reviewing error log files from the website can also help see the reason for a WordPress website error. Your host may have an option to view errors within their dashboard.
If none of the options above worked, it may be best to further investigate by trying a fresh install of WordPress and using the same wp-config.php file or using a developer’s services to further troubleshoot.