Fix HTTP Error When Uploading Images to WordPress

HTTP error occurs when there is an error when uploading a file into the media library. This guide will provide a few proven ways of fixing the HTTP error in WordPress.

Prerequisites

To follow along with this tutorial, you will need the following:

A working internet connection

Access to your WordPress backend or the Cpanel.

Method #1: Confirm the error

In some instances, the error may be fixed by simply reloading the page and re-uploading the image. You should wait for a few moments before attempting to re-upload the image. You should also try switching between browsers to fix the HTTP error.

Method #2: Deactivate recently activated plugins

An unresponsive plugin may cause the HTTP error when uploading your images.

1. Log into your WordPress dashboard.

2. Hover over the Plugins tab on the left panel and select ‘Installed Plugins’. You should then deactivate the plugin recently installed as illustrated below then attempt re-uploading the image.

Method 3: Increasing the WordPress memory limit

Low memory may result in HTTP error when uploading files into WordPress.

1. Log into your Cpanel dashboard then open the file manager.

2. On your website’s folder, select the ‘functions.php’ file then hit the edit option on the top bar.

3. You now need to copy and paste the line of code below onto the functions.php file.

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

You need to hit the ‘Save Changes’ button at the top right corner for the changes made to take effect. This method should fix most of the HTTP errors. However, if the issues persist, move to method 4.

Method #4: Define your default Image Editor.

WordPress has two image editors namely Imagick and GD Library. However, Imagick is mostly prone to resulting to the HTTP error when uploading images. Therefore, you should define the GD Library as your default image editor.

1. Log into your Cpanel and open your website folder. You now need to open the wp-content folder as shown below.

2. Open the themes folder then open the theme folder you are currently using.

3. Find and open the ‘functions.php’ file for editing.

4. Copy and paste the code below onto your ‘functions.php’ file.

function hs_image_editor_default_to_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', 'hs_image_editor_default_to_gd' );

Remember to save your changes as illustrated in the image above.

Conclusion

You now know how to resolve the HTTP error in WordPress. Which method worked best for you? Please let us know in the comment section below.

Leave a Reply