How to Fix “HTTP Error” when Uploading Images in WordPress

Have you ever received this error message when uploading an image? Follow our instructions, you’ll have to insert some code in your theme’s “function.php” .

WordPress HTTP Error - message
WordPress HTTP Error – message

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.

I have ran into this HTTP 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 WordPress 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. Plz leave a comment and let me know what you’ve experienced.

Leave a Reply