How to troubleshoot WordPress blank(white) pages.
Every now and then you may experience an issue with WordPress where your website isn’t loading. It’s simply a blank white page.
This sort of behaviour is not uncommon and can be the result of many things due to the diverse 3rd Party nature of WordPress. When a blank page is experienced the most likely cause is that PHP has experienced an error that has resulted in broken functionality; typically resulting in PHP Fatal Errors.
In our experience this ‘white page’ can be can be caused by the following:
- Unmaintained/Incompatible Plugins (Typically due to newer PHP versions.)
- Unmaintained/Incompatible Theme (Typically due to newer PHP versions.)
- PHP Memory Limit exceeded
- Broken MySQL Connection (Typically due to newer PHP versions.)
- Syntax Errors (Usually due to modification of theme files, i.e functions.php)
In most server configurations you’ll probably see an HTTP 500 error that displays on the page. This would log to an error log if available, if no log is available there are some steps we can take to determine the issue.
The first step to troubleshoot WordPress would be to check the PHP error log.
It’s usually located in the following paths;
cPanel: /home/$user/public_html/error_log
*Where $user is the cPanel account username.
DirectAdmin: /var/log/httpd/domains/domain.com.error.log
*Where domain.com is the domain you’re checking for.
If no error log exists; we can start to troubleshoot WordPress by disabling plugins and changing the current theme.
Disabling WordPress plugins
WordPress plugins can be disabled through several ways.
- File Managers
- SSH
- FTP
For each one of the above choices; you want to navigate to /home/$user/public_html/wp-content/plugins
Here’s what it looks like in cPanel File Manager
Here’s what it looks like in SSH
[/home/khtest/public_html/wp-content/plugins]# ll
total 36
drwxr-xr-x 4 khtest khtest 4096 2019-03-12 19:18 akismet
drwxr-xr-x 9 khtest khtest 4096 2019-04-19 13:34 all-in-one-seo-pack
drwxr-xr-x 7 khtest khtest 4096 2019-04-19 13:33 contact-form-7
drwxr-xr-x 4 khtest khtest 4096 2019-04-19 13:34 disable-comments
drwxr-xr-x 11 khtest khtest 4096 2019-04-19 13:33 redirection
drwxr-xr-x 8 khtest khtest 4096 2019-04-19 13:34 shortcodes-ultimate
drwxr-xr-x 12 khtest khtest 4096 2019-04-19 13:33 wordfence
-rw-r--r-- 1 khtest khtest 2281 2018-12-16 21:08 hello.php
-rw-r--r-- 1 khtest khtest 28 2014-06-05 10:59 index.php
Here’s what it looks like in FTP.
To disable a plugin; you simply have to rename the plugin.
In cPanel you would right click the file > rename
In SSH; you would use the command ‘mv plugin-name plugin-name-disabled’
Where ‘plugin name’ is the folder name.
Example:
[/home/khtest/public_html/wp-content/plugins]# mv contact-form-7 contact-form-7-disabled
[/home/khtest/public_html/wp-content/plugins]# ll
total 36
drwxr-xr-x 4 khtest khtest 4096 2019-03-12 19:18 akismet
drwxr-xr-x 9 khtest khtest 4096 2019-04-19 13:34 all-in-one-seo-pack
drwxr-xr-x 7 khtest khtest 4096 2019-04-19 13:33 contact-form-7-disabled
drwxr-xr-x 4 khtest khtest 4096 2019-04-19 13:34 disable-comments
drwxr-xr-x 11 khtest khtest 4096 2019-04-19 13:33 redirection
drwxr-xr-x 8 khtest khtest 4096 2019-04-19 13:34 shortcodes-ultimate
drwxr-xr-x 12 khtest khtest 4096 2019-04-19 13:33 wordfence
-rw-r--r-- 1 khtest khtest 2281 2018-12-16 21:08 hello.php
-rw-r--r-- 1 khtest khtest 28 2014-06-05 10:59 index.php
In FTP; the same process as the File Manager; right click > rename
It doesn’t have to be ‘-disable’ that’s just what we used for this guide – you can use ‘-bak’, ‘.bak’, ‘-old’ – really any variation as the changing the plugin folder disables the plugin.
It should be noted that another option exists for those who prefer SSH Access and want to use command line to manage their WordPress installs.
wp-cli is a tool built to help manage WordPress websites over SSH.
In the event you’re using wp-cli; you would follow this process
$ su $user
$ cd public_html
$ wp plugin deactivate $plugin
Plugin '$plugin' deactivated.
Success: Deactivated 1 of 1 plugins.
Where $user is the cPanel account and ‘$plugin’ is the plugin name
Changing WordPress Theme
Some instances the issue may not lie in the plugin. The issue may be the theme, whether due to a changed file or an update applied that resulted in the theme just not loading.
This can affect wp-admin functionality as well and require you to change the theme.
Typically in this situation; you would need to modify the database directly to modify the theme.
You’re going to want to login to your cPanel account and navigate to PHPMyAdmin
Once inside you’re going to see a list of your databases on the left – in this case; we’re using ‘khtest_wp’ – we’ll then go to the ‘wp_options’ table.
Within this next page you’ll see a bunch of data in what is called ‘rows’ – rows are numerical and start from 1.
We’ll want to go to ‘page 2’ and search for rows 40 and 41 (typically always the same in WordPress databases)
These two rows are called “template” and “stylesheet”
We’re going to want to modify these two values of ‘bhost’ (or whatever your theme name is!) to another theme that exists on the server.
To edit there are two ways you can do this.
Method #1 – double click on the row where ‘bhost’ is located and it’ll turn into an editing box.
You would then change ‘bhost’ to your a default WordPress theme such as ‘twentynineteen’ – or whatever theme you have available. Simply click off to the side or it to save changes
Method #2 – clicking on the ‘edit’ button to the left will bring up a larger screen.
Same as Method #1; you would change ‘bhost’ to your a default WordPress theme such as ‘twentynineteen’ – or whatever theme you have available.
Then you would click “Go” to push the change.
Now you’ve updated your WordPress theme so that you can get into ‘wp-admin’ of your website.
Utilize site-code to troubleshoot WordPress
For those tech-savvy – if you’re experiencing an error that isn’t recording to an error log and isn’t displaying to the screen – a true white page.
There are ways to force the error code.
You can apply this to the top of index.php
under the first <?php
flag
function shutdown(){
var_dump(error_get_last());
}
register_shutdown_function('shutdown');
Then reload the page; it should dump the error to the screen allowing you to see what kind of issue is occurring.
Example
array(4) {
["type"]=> int(4)
["message"]=> string(54) "syntax error, unexpected 'register_sidebar'(T_STRING)"
["file"]=> string(62) "/home/khtest/public_html/wp-content/themes/bhost/functions.php"
["line"]=> int(104)
}
It’s recommended that you remove this code as soon as you get the error that you were looking for.
We hope that this guide helps on how to troubleshoot WordPress White/Blank page issues.