Today, I was testing new themes for this blog. Unfortunately, something went wrong and I was greeted by 'Error 500' and no further details. The error occurred on every page and made the website completely unusable. This article will summarise the steps I took to fix this error.
Make a back-up
Once you connect to the FTP server make sure you a back-up of your WordPress directory and the DATABASE, because this may go horrendously wrong!
Enable Debugging (Optional)
The first thing you need to do is to enable the debugging in WordPress. This will help you track down the error. This can only be done via FTP (or SFTP) and wp-config.php
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
// Enable WP_DEBUG mode define( 'WP_DEBUG', true ); // Enable Debug logging to the /wp-content/debug.log file define( 'WP_DEBUG_LOG', true ); // Disable display of errors and warnings define( 'WP_DEBUG_DISPLAY', true ); @ini_set('display_errors', 1); @ini_set('display_startup_errors', 1); error_reporting(E_ALL); // Use dev versions of core JS and CSS files (only needed if you are modifying these core files) define( 'SCRIPT_DEBUG', true ); |
This is an adapted and slightly modified code from wordpress.org.
Download WP
I hope you remember which version of WordPress you had as far as I know it has to be down to X.X correct. Download, extract, copy over the FTP server and override ALL the files (but make sure you have a safe backup!!). The copy of the WordPress shouldn't override your wp-config.php
.
Edit the database
Go to your database and find the table wp_options
. Make sure you have backup your database first. Before making any changes make sure you have a backup.
In the table find option_name ='template'
and option_name ='stylesheet'
and change the theme to the default for that version (in my case it was twentysixteen).
If you have a MySQL here is the code:
1 2 |
UPDATE wp_options SET option_value = 'twentysixteen' WHERE wp_options.option_name ='template'; UPDATE wp_options SET option_value = 'twentysixteen' WHERE wp_options.option_name ='stylesheet'; |
It all worked. Now you can remove the debug code from wp-config.php
.