|
|
Blog

Troubleshooting WordPress: Common Errors and How To Fix Them

Did you know that a new WordPress post is published every 27 seconds? Or that 35% of the web uses WordPress? Or even that WordPress is the significantly the most popular CMS, with a market share of 61.8% (the next most popular CMS – Joomla – only has a 4.7% share!).

It’s safe to say that WordPress is popular – and it’s certainly no surprise. It’s easy to set up, easy to configure, easy to update, and easy to maintain.

Except of course, when it isn’t.

Because things do go wrong. And because we become so used to WordPress just, well, working – we can get quite upset when it doesn’t!

In this article, we’re going to present a comprehensive, easy-to-use guide on troubleshooting WordPress, covering common WordPress errors, and showing you exactly how to fix them. Let’s begin!

Troubleshooting WordPress Errors on Your Site

The real power of WordPress comes from the thousands of plugins and themes that you can use on your site – and any plugin or theme can potentially cause errors. 

The list of potential errors that could be caused through some combination of rogue plugin, out of date theme, incompatible code, or plain bad luck is very nearly endless, so what is more useful than a catalog of errors to trawl through is a more general approach to troubleshooting that helps you quickly identify the root cause of most errors:

  1. Enable WP Debug: If you are not sure what is causing issues on your site, then you can enable debugging mode by editing the wp-config.php file. Simply add define( ‘WP_DEBUG’, true); and define( ‘WP_DEBUG_LOG’, true); above the line that says, “That’s all, stop editing…” in the wp-config.php file. Once enabled, it will show you messages when something changes. You can also use extensions such as WP Debugging and Debug This if you don’t want to edit the configuration files manually.
  2. Read the logs: WordPress logs all changes to a log file. Read the last few lines of this file to understand what has changed recently. InstaWP provides an option to easily access the logs in the dashboard, just navigate to More Options > Tools > View Logs. If you are not using InstaWP yet, you can use plugins such as Activity Log and User Activity Log to monitor changes.
  3. Check for syntax errors: If you manually edited a file, it is possible that you forgot to close a } or missed a ; somewhere. Use an IDE or online PHP syntax checker that can flag any syntax errors.
  4. Remove recently installed plugins or themes: New plugins and themes can cause the site to break. Check for compatibility issues between your WordPress version and the plugins you’re considering before installing them.
  5. Check for misconfigurations in firewall settings: If you are using a firewall or security plugin, you should double-check its settings. If the firewall settings are not configured properly, it can cause the site to refuse connections which causes timeout errors. 
  6. Clear browser cache and cookies: Sometimes you get unexpected results because the browser uses locally cached data instead of fetching a new updated copy from the server. You can force the browser to fetch fresh data by pressing Ctrl+Shift+R, or opening the site in an incognito window.
  7. Contact Support: Some errors take forever to figure out on your own and require a little help to resolve. If you have made the inspired decision to create your WordPress site through InstaWP, you can contact customer support for a faster resolution of your problems. 
  8. Restore backup: You should always back up your site before updating or installing any plugins or themes. You can easily do so with the help of BackupBuddy, UpdraftPlus, BlogVault or other similar plugins. If you have a backup of your site, then you can revert to that immediately then troubleshoot the errors afterwards.

Resolving Popular WordPress Errors

Although it may be possible that you have managed to produce an error never before seen, through some combination of server timeout, poorly coded plugin, and rogue code, the overwhelming majority of WordPress errors are generally the same few bad pennies.

It will almost certainly be one of these issues that has brought you to this page, so in this next section, we’ve listed the most common WordPress errors experienced by WordPress users and explained our top fixes.

Locked Out Of WordPress Admin Panel

Getting locked out of your WordPress website is not uncommon, especially when you are managing multiple websites and can’t remember login credentials. You can create a new user account on your WordPress website by following the steps below.

  1. Log into your SQL server and locate the users table. Click on “New Item” in the top menu.
  2. Fill in the user_login, user_pass (make sure you select MD5 in the functions menu), user_email, user_status (set to 0) and click save. 
unlocking wordpress admin panel, changing email and status to 0
  1. Find out the id of the user that you just created. Go to the users table and click “Select data”. Your new user should be the last entry, take a note of the “ID” value of this user. 
unlocking the wordpress admin panel, taking the user id step
  1. Go to the usermeta table and click “New Item” in the top menu.
  2. Enter the following information to grant administrator role to the new user.

User_id: [id of user we just created]
Meta_key: “[siteid]_capabilities” for InstaWP and “wp_capabilities” for generic WordPress instances
Meta_value: a:1:{s:13:”administrator”;s:1:”1″;}

Note: InstaWP uses a different ID for each site; you can easily see this id at the top of the screen. In the following example, the id is iwpe853.

setting administrator role to the user
  1. In the usermeta table, create another entry by clicking “New Item”.
  2. Enter the following details to escalate the new user’s permissions.

user_id: [id of user we just created]
meta_key: “[siteid]_user_level” for InstaWP and “wp_user_level” for generic WordPress instances
meta_value: 10

escalating new user's permissions

You should now be able to log into the site with the newly created credentials. For an easier solution, it’s worth considering the benefits of using a tool such as InstaWP, which allows you to directly log in to different WordPress sites securely using the Auto Login feature. This is a better option than reusing your passwords on multiple sites, which is a security risk or using a password manager, which stores your credentials on a third-party site and often requires an additional subscription.

WordPress Posts and Images Returning a 404 Error

This commonly happens after migrating the site to a shared hosting provider or due to misconfigurations in the .htaccess file. If your WordPress site is returning a 404 error, then you can try regenerating your site links – this will rebuild and repair all permalinks. 

To rebuild the links go to Settings > Permalinks. Verify all the settings, and click Save. After a few moments, you should see the “Permalink structure updated” message.

If this doesn’t work, then you will need to edit the .htaccess file. You can find this file in the root directory of your WordPress site. We recommend you make a copy of the file before making any changes to it. Open the .htaccess file and check for any syntax errors, you can also replace the content of this file with the default code provided below. 

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

WordPress Not Sending Emails

The most common reason for not being able to send emails is that your WordPress hosting server is not properly configured to use the PHP mail() function. Many email service providers also block emails to reduce spam. If your emails are being blocked by the email service provider, such as Gmail or Outlook, then your emails won’t even reach the user’s spam box. 

The easiest way to fix this problem is by using an SMTP service such as Mailchimp or Sendinblue. Start by installing the plugin of the service you’d like to use. After this, create an account for the service and configure the plugin to use the service by adding its API key. You can also consider using the WP Mail SMTP plugin, which can be used to send emails from any SMTP server, such as Gmail, Yahoo, Office 365, and Zoho.  

WordPress Showing A Maintenance Screen

When you update WordPress or its plugins using the built-in update system, it switches to maintenance mode so that the appropriate files can be securely updated. Anyone trying to access the site during this period will receive the message “Briefly unavailable for scheduled maintenance”.

The maintenance mode normally lasts only for a few minutes and should be turned off automatically. However, if your update is taking longer than usual, then it is possible that a glitch happened that caused your website to be stuck in maintenance mode.

To fix this, you can try deactivating the plugins that you were trying to update. Another way to fix it is by removing the .maintenance file. Log into your WordPress FTP server and open the root directory of your site. Here you should see a .maintenance file, be sure to turn on the setting to show hidden files. Once you find the file, delete it.

Allowed Memory Size Exhausted 

This error usually happens when you are using a shared hosting service that limits the resources you can use. If you are getting memory size exhausted errors, then you can try to manually increase the memory limit of the website. 

You can also change this setting by editing the wp-config.php file. Log in to your WordPress FTP server and find the ”public_html” folder. In this folder, find the wp-config.php file and make a copy of it. Find the following line in the original file:

define(‘WP_MEMORY_LIMIT’, ’256M’);

Replace the number with a bigger number and save the file.

For an easier solution, consider switching to InstaWP, which provides a quick and easy way to change the memory limit from the dashboard itself. You change the limit on InstaWP by going to More actions > PHP Config and updating the number in the memory limit field. 

Maximum Execution Time Exceeded

maximum execution time exceeded wordpress error

WordPress automatically suspends PHP scripts that execute longer than a defined threshold period. This is done to prevent a single process from hogging all of the server resources. You might face a time limit exceeded error if you update a plugin or theme which takes a long time to update.

This setting can also be changed manually, but it can be daunting for new users who haven’t edited the configuration files before. Log in to your WordPress FTP server and locate the .htaccess file. In this file, look for any line that contains the text “max_execution_time“. If the line is present, then update the number next to it with 600 to change the timeout to 10 minutes. If the line is absent, add php_value max_execution_time 600 to the bottom of the file and save it.

For a faster solution, consider switching to InstaWP, as it allows you to quickly change the time limit without needing to edit the configuration files manually. You can do so by simply going to the More actions > PHP Config and updating the value in the “max_execution_time” field.

Missing A Temporary Folder

You might encounter this error when trying to upload files to the WordPress website. When you upload something to WordPress, it first stores it in a temporary folder before sending it to its actual destination. 

To fix this error, log in to the FTP server of your WordPress website and go to the “wp-content” folder. In this directory, create a new folder named “temp”. After creating the folder, go back to the root directory to edit the wp-config.php file.

fixing temporary folder missing wordpress error in wp config

In this file, leave the existing settings untouched and add define('WP_TEMP_DIR', dirname(__FILE__) . '/wp-content/temp/'); below the “Add any custom values …“ line and save the file.

Destination Folder Already Exists Error

This error usually occurs when installing a theme or a plugin that was interrupted during a previous installation or improperly removed. This can be easily fixed by removing the old directory.

Start by logging in to your server using FTP, and go to the wp-content folder. Open either the themes or plugins folder, depending on which it is that you are installing. Rename that folder by adding “_old” to the end of the existing folder name. After this, you should be able to install the plugin or theme without any errors. Once installed, you can safely delete the old folder that we renamed. 

Summary 

If you plan to handle WordPress sites then you are likely to come across errors. Some common errors are descriptive enough that you can immediately figure out the root cause, but at other times it is not so obvious. For businesses, errors can cause huge problems – increased downtime can lead to lost revenue and frustrated customers.

Frequent outages and unscheduled maintenance could damage the reputation of a business, therefore, it is essential to use a staging environment to test changes, plugins, and themes before deploying them on the production site. InstaWP Launcher for Chrome makes it possible to test any plugin or theme on a fresh WordPress site with a single click. Sign up for a free trial for InstaWP to speed up your WordPress development workflow.

Like the read? Then spread it…
Facebook
Pinterest
LinkedIn
Twitter
Meet the Author
You might also like

Ready to build
WordPress sites?

InstaWP is an all-one-in developers toolbox where you can get started 
on WordPress in an instant, build the site and host it anywhere.

Request demo

Wondering how to integrate InstaWP with your current workflow? Ask us for a demo.

Contact Sales

Reach out to us to explore how InstaWP can benefit your business.