How to fix “HTTP Error” when uploading images in WordPress

Have you ever received this error message when uploading an image?

WordPress HTTP Error - message

Follow these instructions, you’ll have to insert some code in your theme’s “function.php”

  • Go to “Appearance > Editor”
  • Under the right sidebar labeled “Templates”, click on “Theme Functions (functions.php)”
  • Add the following code:

add_filter( 'wp_image_editors', 'change_graphic_lib' );

function change_graphic_lib($array) {
return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
}

But don’t just add it anywhere. Add it right after “<?php” and before any other comments or code. Comments will have text in between “/*” and “*/” (it can have multiple asterisk as well such as “/*****” and “*****/“). Everything between “/*” and “*/” is ignored by what’s reading code, hence it is simply used to embed neutral comments for the programmer to read, to help them make sense of the code.

Here’s what it should look like:

WordPress HTTP Error fix - screenshot

I’ve ran into this error message far too often and it took me a long time to figure out how to fix the problem reliably. So far this has fixed the problem for all of my websites. Hopefully it works for you too. I’ve found other ways that claim to fix the problem, but this way seems to work the best. Please leave a comment and let me know what you’ve experienced.

Leave a Reply