Post Image

How To Troubleshoot WordPress Errors And Glitches

Often you can see what Wordpress show some errors for you. This errors can arise from plugins, themes. How to fix this issues?

To be fair, the core code of WordPress is very well coded and thoroughly tested, so there are rarely errors with it. The problem with WordPress comes with the multitude of third-party plugins and themes that greatly extend the functionality, but also introduce their own bugs, incompatibilities, and issues.

So if you’ve suddenly come across a problem with a WordPress site and want to try and sort it out on your own, use this simple step-by-step guide to troubleshoot and resolve it as quickly as possible.

Before you do any of these steps, you should make sure to backup your whole site. Ideally you should also have a backup from before the error occurred, so in the worst-case scenario you can just restore your site from backup.

We wrote some popular issues and fixes for them.

 

1. Deactivate Plugins

9 times out of 10, you’ll find that it’s a rogue plugin that’s causing your problems. Outdated or buggy plugins can cause a whole range of problems and you could be tearing your hair out trying to work out how to fix them, when all you needed to do was deactivate the offending plugin.

If you’ve just installed a new plugin and your site breaks, the culprit will be pretty clear. Simply deactivate and delete the plugin. If you really want to use this particular plugin, have a look at the troubleshooting section of the developer site and see if there are any common incompatibilities or other issues that can be easily sorted.

If you’ve just updated a plugin, it’s possible that some new bugs were introduced. Your best course of action in this case is to rollback to a previous version of the plugin and check the developer site to see if anyone else has reported the same problem. Sometimes there may be a solution, or you may need to report the bug to the developer so it can be fixed.

Sometimes errors and glitches will just seem to happen randomly and you won’t have any idea what’s causing them.

I’ve found the best way to deal with this situation is to deactivate all plugins and see if the problem is fixed. If is then you know a plugin is causing the problem and you can activate each plugin one by one until you find the one that is causing issues. If you’re still having issues even when all the plugins are deactivated, the problem may be caused by your theme or something else and you’ll need to move onto the next step of troubleshooting.

2. Temporarily Change Your Theme

Many modern themes have plugins and other code embedded into them and this is also a common cause of problems.

If you’ve installed a new theme and you’re getting strange error messages, check the support files for incompatibilities – it may be that you have a plugin installed that is already embedded into the theme, or it may not play nicely with some other plugins for whatever reason.

Sometimes upgraded versions of themes can break your site. The easiest way to fix this is to downgrade to the version of the theme you were using before you came across the problem.

If you’ve eliminated plugins as causing the errors you’re experiencing, you’ll want to check if your theme is the issue next. To do this, change your theme to one of the WordPress default themes such as Twenty Seventeen and see if the error goes away. If it does then you’ll know your theme is causing the issues and you can either try and resolve them (check with the theme developer for advice) or use a different theme altogether

3. Check Your .htaccess file

The .htaccess file contains instructions for the server. Sometimes it can become corrupted and this may cause error messages that start “500 Internal Server Error”.

If you suspect your .htaccess file may be causing problems, log into your site via FTP and locate .htaccess in the root of your WordPress directory. Sometimes this file is hidden and you’ll have to select “show hidden files” in your FTP client settings to find it.

Once you’ve found the file, rename it to something like “.htaccess-old”, which will stop it being used and reload your site.

If you still have errors on your site then you’ll know .htaccess isn’t the problem and you can go ahead and rename it back to .htaccess again. If the problems have been sorted, generate a new .htaccess file by resetting your permalinks (just save a different permalink structure and then change it back and re-save).

4. Upgrade/Downgrade WordPress or Reinstall the Core Files

If your WordPress version is out of date, it’s always worth updating to the latest release and seeing if it solves the problem. The same goes for plugins and themes that are out of date.

Even if you have the latest version of WordPress installed, you can re-install it easily with the button on the updates section of your dashboard.

Sometimes this fixes problems if any of the core files have been corrupted. You can also do this manually by downloaded the latest version of WordPress and replacing the contents of your wp-admin and wp-includes folders via FTP. This shouldn’t affect any of the content on your site.

Bugs in a new release of WordPress occasionally cause problems too. If you suspect this to be the case, you can install an older version of WordPress and see if this fixes the error.

5. Enable Debug Mode

By default, most errors and warnings are repressed by WordPress. You can enable them by editing your wp-config.php file, changing the following line of code from false to true:

//define('WP_DEBUG', false);

define('WP_DEBUG', true);

This will allow all errors and warnings to be outputted to the screen and might give you a better idea of what’s going on.

You can often search for the exact error message you’re getting in Google and find instructions on how to fix it.

6. Increase your PHP Memory Limit

If your site is taking forever to load and you’re getting timeout errors, or you’re getting other random glitches and errors, it may be because your server is running out of resources.

You can also find this setting in your wp-config.php file. Access the file via FTP and add the following line of code:

define('WP_MEMORY_LIMIT', '64M');

Save the file and re-upload and see if the problem has been fixed. If not you could try increasing the memory limit again to ‘128M’ or ‘256M’.

7. Talk to Your Webhost

Often errors are caused by incorrect configuration on your web server and if you’re on shared hosting, you probably won’t be able to fix this by yourself. Some hosts also control setting such as the PHP memory limit mentioned above and will need to change them for you.

If you’ve tried all the above steps and your site is still broken, it’s worth getting in touch with your host and explaining the problem you’re having. They may be able to fix it or offer some other suggestions of how you can fix it yourself.

8. Restore From Backup

If your site is really messed up and you’ve already tried everything you can think of to fix it, the final resort is to restore from a previously backed up and working version of your site.

This is only an option if you already made a backup, so make sure you backup your site regularly as you never know when you’ll need to recover your site.

 

Common WordPress Errors and How to Fix Them

Chances are, you’re not the first person to ever experience the error that’s causing you problems. Many WordPress errors are common and well known and there’s often an easy fix. Some fixes you will see in this post, if you will not to find here your issue, just write your issue on the internet and you will see more fixes for this issue

1. Custom Edits to a Theme Disappear or Break on Updating Theme

This is a very common problem and is usually caused by user error. If you’ve made manual edits to a WordPress theme, these edits will be overwritten when you update the theme.

The correct way to edit a theme is to create a child theme containing your customizations. Your changes will then be safe when you upgrade to a new version of your theme.

If you didn’t create a child theme and your site is already broken, you have little choice but to restore from backup. You can then try and extract your edits from the original code to a new child theme before you upgrade the theme. The other option is not to update the theme at all but this is not usually the best idea as outdated themes may pose a security risk.

2. WordPress White Screen of Death

If you load your site and see nothing but a blank white screen, you’re experiencing the dreaded “white screen of death”.

This can be caused by several reasons and it’s often an annoying problem to fix, as you don’t get any clues as to what’s wrong.

The recommended course of action to fix this problem is:

  • Increase the memory limit
  • Disable plugins
  • Switch to a default theme
  • Enable debug mode

If all else fails, you may have to reinstall WordPress or restore from a backup.

3. Can’t Access WordPress Admin

Being locked out of your WordPress administration panel is a frustrating problem. This is often caused by a buggy plugin. Security plugins are particularly good at stopping you from getting into WordPress – if you get a message that your password is wrong but resetting it doesn’t work, this is probably due to an over-zealous security plugin.

Luckily this is an easy fix. You can simply deactivate plugins by renaming their folders temporarily (I usually append something like “-temp”) and then you should be able to log into your site as normal.

If you’ve lost your password, you can reset it manually from your WordPress database. You can find full instructions of how to do this at the WordPress Codex.

4. WordPress Visual Editor Doesn’t Load Properly

If you go to edit or create a new post and see what looks like a blank screen or buttons missing, you’re experiencing a very common problem. The text is actually usually there but it’s white (try highlighting it with your cursor).

Most of the time this is caused by a plugin conflict, so try disabling your plugins one by one to see if you can fix the issue.

It’s also worth trying to access the site on a different browser. If it works using the other browser, try clearing your browser cache and seeing if this fixes things.

This problem is also caused by concatenated JavaScripts that aren’t working properly. To fix this issue, add the following line of code to your wp-config.php file:

define('CONCATENATE_SCRIPTS', false);

5. Images Aren’t Loading or Errors on Uploading Images

If you notice that all the images on your site are suddenly broken, or you can’t upload images using the media uploader, this is most likely caused by incorrect file and directory permissions.

To check your file permissions, log into your site using FTP and navigate to the wp-content directory. These instructions are for the Filezilla FTP client but they should be similar for other FTP clients.

Right-click on the uploads folder within this directory and select “file permissions”. The permissions for this folder and the files within it should be 755. Make sure you select the option to “recurse into subdirectories” and “apply to directories only” so that all the folders inside the uploads folder are also given the correct permission.

Right-click on the uploads folder again. You now need to change the permissions of all the files to 644. Check the box to recurse into subdirectories again, but this time choose the “apply to files” only option.

Once you’ve reset your permissions, with any luck your images should be working again.

6. 404 Error Pages

If trying to access a file on your website that you know exists gives you a 404 error, this is most likely due to an URL rewrite bug in the .htaccess file.

Luckily this is a very easy fix. Go to Settings > Permalinks and choose a different permalink structure for your site. Save it and then select your original permalink structure and save again. This should reset your .htaccess file and get rid of the 404 errors.

7. WordPress Syntax Error

If when you load your site you get nothing but a blank white screen with an error message that says something like

Parse Error: Syntax error, unexpected '<' in home/admin/public_html/wp-content/theme/functions.php on line 22

This means there is an error in the code. Every time I’ve got this error it’s because I was editing the code myself and I’ve missed out a semi-colon or something, but it is possible that something could have gone wrong with a theme or plugin.

Thankfully, this type of error message is one of the most helpful within WordPress as it tells you not only the file that includes the error, but also the exact line that contains the error and what exactly the problem is.

In conclusion

As you can understand, most of the errors in the Wordpress are not for the first time and most likely solutions have already been invented for these problems. We hope that this post will be useful to you, and you will be able to correct your problems.