WordPress HTTP Error (Details & Fix)
- By Admin --
- Jun 28,2021 --
- 1730 Views ,
- 4 Comments
WordPress HTTP error is one of the most common errors that users can face while uploading images to the media library. So, if you are facing this too, you don’t have to worry, as there are quick fixes available for this issue.
But why does this error occur, what it actually is, and how can you solve it permanently? We’ll address all these questions in this article.
What is WordPress HTTP Error?
As a WordPress user, you can face this error when uploading the images and videos to the media library. As the nature of the error isn’t defined, so it could be caused at any random step.
How to fix this error?
Fortunately, the fixing of this error won’t require much of your time. But you might have to test a few solutions before you can find the right one.
Here are a few fixes you can employ:
Give it some time:
Well, you don’t have to do anything in this solution other than waiting. Sometimes, a temporary glitch in the HTTP Status could be causing this error, and it can be resolved within a few minutes.
In some cases, changing the file name and removing apostrophes from it could be helpful for the resolution of HTTP errors.
Change the browser:
You might face this error on WordPress on a particular browser. Your browser might not be able to send or receive data from the server at a particular point.
So, changing your browser might resolve your issue.
Deactivation of the plugin:
Plugin deactivation should be on your priority list if you have installed a new plugin recently. This could be particularly related to image optimizers. If a particular plugin is creating any error, removing it and using any alternative can help.
Resolve the memory issues:
In some cases, low WordPress memory could be creating this WordPress HTTP Error. Adding the following line of code in a wp-config.php file can increase the memory limit up to 256MB.
define( 'WP_MEMORY_LIMIT', '256M' );
Higher memory means you won’t face issues in uploading your images and media files.
Resize the files:
Search engines and your visitors definitely require crisp images, but it is optimal to keep the size of the image under 100KB. Decreasing the image size might make the image uploading process convenient.
In some cases, switching the image format can also help in the resolution.
USE GD Library as Default Error:
WordPress comes with two editors. Although both of them are functionally awesome but using, Imagick requires a lot of memory in the editing process, as compared to GD Library. So, you can set up GD Library as your default editor to resolve this issue.
To do so, you’ll have to place this code in your theme’s function.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' );
Editing .htaccess file:
As it is one of the crucial files in Wordpress’s functionality, editing it might resolve the error.
There are multiple lines of code that you might want them to fix the error. However, add them separately, save changes, and then upload the file to the root directory.
We’ll suggest you start with:
SetEnv MAGICK_THREAD_LIMIT 1
If saving and reloading the website did not help in resolving the issue, then here are a few other lines you can add:
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
Here is another snippet, you might want to add and try:
# Exclude the file upload and WP CRON scripts from authentication
<FilesMatch "(async-upload\.php|wp-cron\.php|xmlrpc\.php)$">
Satisfy Any
Order allow,deny
Allow from all
Deny from none
</FilesMatch>
Hopefully, one of these codes will resolve the error.
Checking the theme:
If a new theme installation or up-gradation has caused the issue in the WordPress website, then checking the theme in this regard would be the right thing to do.
Summing up:
While the WordPress HTTP Error is broad and doesn’t provide real insight into what is wrong with your website, you can apply the fixes we have shared. We don’t know which of these solutions will actually work but applying them one by one will help you identify the issue and resolve it. So, try your luck!
Comment