WordPress Clear Cache [Step-by-Step Guide]

If you’re looking for instructions on how to clear your WordPress cache, you’ve come to the right place.

Rather than built-in caching, WordPress relies on various plugin options. This lets developers build different and competing solutions which is great, but it means that we have a few different ways to clear the cache depending on which option your site is using.

Check out the cache plugin index for solutions to clearing each caching plugin, or jump right in below:

 

Hint* – If you’re not sure which caching plugin your site uses, check your ‘Plugins’ page in the admin panel, and look for any of the plugins on the list (above) that might be active.

If your site is using w3 Total Cache, navigate to Performance > Dashboard in the admin panel and click the ’empty all caches’ button:

w3 cache clear

 

If your site is using WP Super Cache, navigate to Settings > WP Super Cache and click the ‘Delete Cache’ button to clear it:

If you’re using WPEngine, it comes with a built-in caching solution. Click on the WP Engine menu, navigate to General and click the ‘Purge All Caches’ button:

WPEngine Cache Clear screen

If you’re using Securi for caching, go to Performance > Clear Cache – Global, and then hit the green Clear Cache button:

Securi cache clear screen

Http Error Uploading Image – WordPress

Http error uploading image wordpress

Are you seeing the ‘Http error uploading image’ or ‘Unable to create directory wp-content/uploads/[current year]/[current month]. Is its parent directory writable by the server?’ message in WordPress?
These are both very common errors, especially on new installs. Luckily, the fix is a breeze – so stay tuned to learn how to get that image uploaded successfully.

Solution #1: Check the Directory Permissions

You can set the permissions necessary for WordPress by running the following commands in the root directory of your WP install:

sudo find . -type f -exec chmod 664 {} +
sudo find . -type d -exec chmod 775 {} +
sudo chmod 660 wp-config.php

This will ensure that your folders have the right permissions, which is required for image uploading to work correctly. Once you apply the permissions, test and see if you’re able to upload the image as intended. If you’re interested in learning more about filesystem permissions and why WordPress uses these in particular, Benjamin Intal has a great article with extensive info here.

Proceed to the next step if your issue is not resolved.

Solution #2: Raise the WordPress Memory Limit

If you’ve confirmed that your directory permissions are correct from the first solution, the next thing to try is raising the memory limit in WordPress to allow for larger files to be uploaded. WordPress may be running out of memory on the upload and throwing the error for that reason. To check, open your wp-config.php in the root directory of your WordPress site, and search for ‘WP_MEMORY_LIMIT’. If you don’t find it, add the following line:

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

If that line was already present, try raising it to something higher. The ‘M’ stands for Megabytes, and it’s extremely unlikely that any image you’re trying to upload ever exceed 256 megabytes, so this is a great limit to raise it to. If you’re uploading videos rather than images, however, note that you may need to raise this limit even higher.

Save the wp-config.php and retry your upload. Check if your http error uploading image WordPress is resolved.

Hopefully the new expanded memory limit solved your problem. If it did, let me know about it in the comments! If not, proceed to Solution #3 for the next fix.

Solution #3: Change the Image Library

PHP has two different options for image processing library – Imagick or GD Library. Either library will generally work fine and play nice with WordPress, but on some hosts Imagick may run into memory issues. In this fix, we set GD Library as the default to see if there’s a problem with Imagick on your web host.

Open your theme’s functions.php file located in wp-content/[your_theme_here]/functions.php and add the following snippet to the end:


function image_editor_default_gd( $editors ) {
    $gd_editor = 'WP_Image_Editor_GD';
    $editors = array_diff( $editors, array( $gd_editor ) );
    array_unshift( $editors, $gd_editor );
    return $editors;
}
add_filter( 'wp_image_editors', 'image_editor_default_gd' );

Save your changes and try uploading the image again. With any luck, GD Library did the trick! Let us know in the comments if this worked for your http error uploading image WordPress.

Error Establishing a Database Connection – WordPress

error establishing database connection wordpress

We’ll unravel the mystery of the dreaded ‘error establishing a database connection’ WordPress issue once and for all, and get your site and database playing well together.     

Read on for the solution!

 

Are you seeing this error establishing a database connection in WordPress? This is one of the most common errors that comes up in WordPress, and it can be frustrating when it just won’t connect to your database no matter what you try. Fear not!

Fix #1: Check wp-config.php and confirm you have the right credentials

open up the file wp-config.php in the root directory of your website. This file contains the credentials that WordPress uses to connect to the database. Specifically, we’ll look at these 4 lines:

define( 'DB_NAME', 'database_name_here' );
define( 'DB_USER', 'username_here' );
define( 'DB_PASSWORD', 'password_here' );
define( 'DB_HOST', 'localhost' );

Double-check these 4 lines and make sure that they match your database credentials exactly. Check for spaces and capitalization. Often, switching the DB_HOST from 'localhost' to '127.0.0.1', or vice versa from '127.0.0.1' to 'localhost' is enough to solve the issue, so try flipping the DB_HOST after you’ve checked the first three credentials.

Error establishing a database connection wordpress

*Hint – if you’re unsure where to find your database credentials, consult with your web developer or web host.

 

Fix #2: Repair the WordPress Database

No success with the first fix? No problem! Sometimes the WordPress database can become corrupt, so the next thing we’ll try is a database repair. WordPress has an automated tool for DB repairing which makes this fix a cinch to apply.

First, you’ll need to allow database repairs through your wp_config.php file. Open wp_config.php and add a new line at the very end of the file as follows:

define('WP_ALLOW_REPAIR', true);

Save the file and then point your browser to [your_site_url]/wp-admin/maint/repair.php

Wordpress Database Repair Screen

This launches the database repair tool, where you’ll see the option to ‘Repair the Database’. This may take some time, so be patient once you click to repair. Hopefully after the repair, your WordPress error establishing a database connection will be resolved. Test to see, and move onto the next fix if you’re still having issues.