// Tutorial Series //
Common WordPress Errors
Default avatar
By Lyn Muldrow
Senior Developer Educator
Common WordPress Errors

Introduction

This tutorial series explains how to troubleshoot and fix common errors that you may encounter when deploying, maintaining, and updating your WordPress installation.

Each tutorial in this series includes descriptions of common deployment, maintenance, or update errors, and explores ways to fix and optimize your installation to scale.

Summary View
detailed View
// Tutorial //

Introduction

WordPress is a robust Content Management System (CMS) that provides blog and site infrastructure, creation, and publishing tools. While WordPress is a well-maintained, open source CMS, you may sometimes encounter issues or errors that will prevent you from having access to common functionalities.

In this tutorial, you’ll learn how to perform steps to ward against common WordPress errors in a way that also optimizes your site to prevent those errors from occurring in the future.

Step 1 — Creating a Backup of Your Site

Before you begin any troubleshooting process, it’s wise to back up your site. Creating backups of your site, whether manually or by using a plugin, allows you to restore your WordPress installation in the event of an error. A backup also serves to protect your WordPress site against security threats, data loss, and more.

Learn How To Back Up Your WordPress Site to Object Storage with our tutorial, or explore WordPress Backup Plugins to automate the backup process.

Step 2 — Making Sure your Cache is Clear

A cache is a temporary storage space that allows browsers and programs to take a snapshot of your site and store temporary files and data, to load your site faster and increase performance.

While caching does generally give a performance boost to site load times and improves user experience, sometimes errors with visual elements may be a result of a cached version of your site being served. Clearing your browser cache as well as your WordPress cache typically solves issues with older or cached versions of your site being shown.

This list shares step-by-step information to clear your browser cache on any browser, and there are a number of site caching plugins available that allow you to clear and maintain WordPress cache size, in order to optimize your site’s appearance and performance.

Step 3 — Auditing Your Plugins

Plugins are third-party software added to WordPress installations to extend functionality. Even though these extensions provide helpful and convenient features, they can sometimes conflict with each other and cause your site to experience issues in performance, speed, and security.

To audit your plugins and potentially troubleshoot an error, start by ensuring that each of your plugins are updated to its most recent version. Next, you can also deactivate all plugins and reactivate them one-by-one.

While inside of your WordPress site’s admin panel, click Plugins, then All Plugins. Within your list of plugins, click the box to Select All, then click Deactivate from the dropdown above the checkbox. Click Apply to deactivate all plugins.Then, select one plugin at a time and click Activate to reactivate each of them while monitoring your website to identify any issues .

Conclusion

This tutorial highlighted three steps that you can take to prevent your WordPress site from experiencing common errors, and to maintain the health of your WordPress installation.

For more information on optimizing your Wordpress installation on Ubuntu, visit our tutorial, How to Optimize WordPress on Ubuntu 20.04.

// Tutorial //

Introduction

In WordPress, oftentimes one of the most important pieces of information that is forgotten or misplaced is the admin password.

In this tutorial, learn how to retrieve or reset your WordPress admin password from the command line using WP-CLI, a tool that allows users to manage WordPress blogs from a terminal.

Prerequisites

To follow this guide, you’ll need:

Step 1 — Resetting Your WordPress Admin Password via WP-CLI

WP-CLI is a utility that allows you to perform administrative tasks via the command line. In this step, you’ll use the WP-CLI utility to reset your WordPress admin password.

After you have successfully installed WP-CLI, navigate to your main WordPress directory:

  1. cd /var/www/wordpress/

Next, you’ll grab a list of the users that are authorized to edit your WordPress site:

  1. wp user list
Output

Once the list is produced, locate the name and user ID of the admin user whose password you’d like to reset. To update the password for the user selected, enter the following, replacing the highlighted password with a secure password of your own choosing:

  1. wp user update 1 --user_pass=password

Your WordPress admin password should now be changed. In the next step, we’ll test the changes to ensure that your new admin password has been applied.

Step 2 — Testing Your WordPress Admin Password

After setting up a new admin password via WP-CLI, it’s a good idea to test the changes to be sure the password was applied correctly. To test your password, log in to the WordPress admin panel at https://yoursite.com/wp-admin, replacing the highlighted text with your website’s domain name or IP address.

If you are able to log into your WordPress dashboard, you’ve successfully changed your WordPress admin password via WP-CLI. If you’ve encountered an error, repeat Step 1 using a new password, then attempt to log in again.

Conclusion

In this tutorial, you used the WP-CLI utility to update your admin password. For more comprehensive information about WordPress, visit our list of WordPress resources.

// Tutorial //

Introduction

When uploading new media files to your WordPress installation, you may sometimes encounter an issue that can prevent you from writing data to your site’s storage folders. This error typically happens when trying to upload images, videos, and other files to posts and pages on your WordPress site.

In this tutorial, we’ll work to troubleshoot one common error message:

the uploaded file could not be moved to…

This error is a result of failure while attempting to upload a file to your /wp-content/uploads folder.

Step 1 — Identifying and Replicating the Issue

The first step in troubleshooting any issue is to attempt to gain an understanding of where the error is coming from, and how to replicate the issue. If you can isolate an issue to a certain part of your WordPress site’s code, you can better identify how to fix the issue.

Let’s take a look at the error message:

The uploaded file could not be moved to...

From this message, we can identify that although the file was sent to the server, it was not possible to move it to the destination folder wp-content/uploads or similar. It is likely that the system user running the application doesn’t have permission to write content to the destination folder.

WordPress files are typically hosted on a web hosting server or Droplet, and require certain permissions to work properly. If file permissions are wrong for the file or directory you’re attempting to read or write to, you may receive the error previously mentioned, or a similar error message.

To replicate the issue, attempt to upload (or write) a new file to your intended folder. Notice the behaviors that occur up until the error, and note if the error has changed or remained the same.

If you’ve replicated the issue, move forward to step 2 to fix the permissions issue that is preventing you from uploading to the wp-content/uploads folder or similar.

Step 2 — Fixing Permissions in WordPress Uploads Folder

For issues with uploading to your wp-content/uploads folder, you may again be encountering the following error messages:

‘The uploaded file could not be moved to wp-content/uploads/’

‘Unable to create directory wp-content/uploads/~. Is its parent directory writable by the server?’

To fix this error, you’ll need terminal access to the server where your WordPress site is installed. For more information on how to log into remote servers, you can follow our guide on how to connect to Droplets with SSH, which covers this process in detail. For help with command line basics using Linux, visit A Linux Command Line Primer.

Once you’re logged in, verify the location of your WordPress site on the server. Depending on your setup, this could be a path such as /var/www/, /usr/share/html/, or a custom location defined by the server administrator. You’ll need this information to execute the next command.

Next, run the following command, which will set up the user www-data as owner of the WordPress uploads folder. The www-data user is typically the system user that runs the web server, both on Apache and Nginx installations. This user needs write access to the WordPress uploads folder in order to copy the uploaded file to the correct location.

Replace the highlighted path with the path to your WordPress installation:

  1. sudo chown -R www-data /var/www/mysite/wp-content/uploads

This command evokes administrator privileges via sudo, so you may be required to provide your user’s password if this is the first time using sudo in your terminal session. This will set up correct folder permissions so that the www-data user is able to read and write data to your wp-content directory and upload folder.

Step 3 — Testing for Errors

After entering the aforementioned command, it’s time to test for the initial error. Try uploading a new file to your WordPress installation, and note what happens. If you’ve successfully uploaded a file, the permissions have now been set to allow you write access to the intended folder, and the issue should have been resolved.

If you’re still receiving the error message, check with your hosting provider to understand where permissions for your WordPress installation are set, and ask for assistance in setting the correct permissions.

You can find more information about recommended WordPress folder permissions on the official documentation.

Conclusion

In this tutorial, we successfully identified, corrected, and tested an issue in uploading files to the wp-content folder in a WordPress installation.

For more on WordPress, including help with optimization, installations, and more, visit our comprehensive list of WordPress resources.

// Tutorial //

Introduction

The 500 Internal Server Error code can be an ambiguous one when maintaining a WordPress installation, and issues in PHP or the web server) could likely be the culprit. If you are receiving a 500 error on your WordPress installation, this tutorial will share solutions to help you identify, solve, and verify that the changes you made were successful in getting your WordPress site running smoothly again.

Step 1 — Identifying and Replicating the Issue

An Internal Server Error HTTP code indicates that the server is having an issue, but cannot be specific about what sort of issue it’s having. Using this knowledge about the 500 Internal Server Error code, let’s take a look at the error message:

`HTTP Error 500 NGINX`

To solve this problem, the first step is to replicate and monitor the error. If you recently enabled, changed settings, or upgraded a plugin, there is a chance the plugin is the culprit of your issues.

Deactivating WordPress Plugins

You may want to start your audit by disabling your plugins one by one and seeing if this changes anything.

To deactivate your plugins temporarily, navigate to your WordPress dashboard and select Plugins. In your list of plugins, locate the Deactivate button and select it to start the process of disabling your plugin. Repeat this process for each plugin you have activated.

Deactivate WordPress Plugins

Auditing Web Server Logs

As mentioned before, the 500 Internal Server Error on WordPress sites can happen for a wide variety of reasons, all related to the back end server. Auditing your web server logs can be a helpful practice to identify the issue or what may have caused it in the first place.

To audit your server log, enter the following in the command line:

  1. tail -f /var/log/nginx/error.log

After entering, reload your current WordPress page to see if more information on the error is shown.

If you still can’t identify the specific code that is triggering this error, the issue might come from an incompatible or damaged installation of either WordPress or PHP on the server. In the next step, you’ll see how to upgrade WordPress and PHP to make sure this is not what’s causing your error.

Step 2 — Updating Your Installation

To make sure the 500 Internal Server Error encountered on your WordPress installation doesn’t come from a damaged or incompatible installation of either WordPress or PHP, you’ll need to check your currently installed versions and update them accordingly. Keeping your web server and your WordPress installation up to date is a good security practice and should be incorporated as a regular maintenance task.

Updating WordPress

When you’re experiencing a 500 Internal Server Error, you may have limited access to your site, to update WordPress automatically. If the error is not preventing you from accessing your WordPress admin panel, log in to your /wp-admin dashboard. Because WordPress automatically sends notifications on new updates available, there may be a notification at the top of your dashboard:

WordPress update notification

If there is no notification, you can update your WordPress installation by visiting the Updates section, and selecting Update when prompted to update your WordPress site.

After the update, move to Step 3 to test for the 500 error. If you are still experiencing the error, return to this step to update your version of PHP.

If you aren’t able to log into your dashboard because of the 500 error, you’ll need to perform a manual WordPress update via the command line.

Updating PHP

To update your version of PHP on your WordPress installation, you’ll need to check your hosting provider’s steps to accessing and updating the PHP version on your installation. Some providers allow for updates via cpanel, while others require updates on their platform. Consult with your hosting provider’s documentation to learn more about how to update the PHP on your WordPress installation.

You can also manually update your installation - learn more about this process and why updating PHP for WordPress sites is important on WordPress’ official documentation.

After you’ve successfully updated your WordPress installation and/or version of PHP, it’s time to move to Step 3 to test for errors.

Step 3 — Testing for Errors

To test for errors after updating your WordPress installation and/or PHP version, try accessing your domain.

If you encounter the 500 error again and have successfully updated your version of PHP as well as your WordPress installation, you’ll need to check with your hosting provider to dive deeper into issues with your server that may exist beyond your site.

If you’ve successfully resolved the 500 error, you’ll have also updated your installation to ward against commonly experienced bugs and security vulnerabilities. It’s a good practice to keep both your WordPress installation and PHP versions updated for this reason, and can prevent 500 errors from occurring in the future.

Conclusion

In this tutorial, we successfully performed troubleshooting a 500 error on a WordPress installation, commonly experienced when either the WordPress installation or PHP version is damaged or outdated.

For more information on error codes and how to solve them, visit our tutorial, “How to Troubleshoot Common HTTP Codes”.

// Tutorial //

Introduction

Sending emails and notifications including form submission verifications and password resets from your WordPress site is an essential function. The process of sending automated emails is typically handled by an SMTP (simple mail transfer protocol) server, but because SMTP servers are often complex to set up and require constant maintenance and monitoring against spam practices, using an external mail service is often a viable solution to attend to your WordPress site needs.

In this tutorial, learn how to install and configure the Easy WP SMTP plugin to send emails from your WordPress site using an external mail service such as Gmail.

Step 1 — Installing the Easy WP SMTP Plugin

There are a number of ways to set up your WordPress site to send email notifications, and choosing the right one for your WordPress depends on your server configuration and preference. While you could choose to send emails directly from your server, the safest and most secure way to send emails from your WordPress site is through use of an external Email Service Provider (ESP) or SMTP server. Using an ESP or SMTP server ensures compatibility with popular email servers, and keeps emails from your server or Droplet out of spam and junk folders.

For this tutorial, we’ll use the Easy WP SMTP plugin. You can install this plugin by visiting your WordPress dashboard, then accessing the Plugins item from the left menu. Click the Add New Plugin button, then search for Easy WP SMTP within the Search Plugins… search box.

After installing the plugin, click on the Activate button to enable it. Then, move on to the next step to configure the Easy WP SMTP plugin to work with your SMTP server for outgoing emails.

Step 2 — Configuring WordPress Email Settings

To configure your WordPress SMTP plugin, visit Settings on your dashboard’s left menu, select the Easy WP SMTP menu option, then visit the General Settings tab within to set your preferences for Sender Name, SMTP Port, credentials, and more.

Wordpress WP SMTP

For detailed information about the various Easy WP SMTP plugin settings available, visit the main plugin page.

Step 3 — Testing Email Settings

To test your settings, navigate to the Easy WP SMTP settings page, towards the bottom of the page to Testing and Debugging Settings. You can send test emails and work to debug errors with your email server by augmenting the fields in this section.

For more details about testing, visit the plugin download page.

Conclusion

In this tutorial, you used the Easy WP SMTP plugin to set up outgoing emails from your Wordpress site. To learn about alternative ways to use SMTP servers with DigitalOcean Droplets, visit this tutorial, Using Gmail SMTP Servers to Send Email From WordPress on DigitalOcean.

Check out all our Tutorial Series

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel