What is a 400 Bad Request Error?
The 400 Bad Request Error indicates that the server was unable to process the request due to invalid syntax. It falls into the Client Error category. So, the 400 Bad Request error happens before it is even processed by the server.
In this article, i’ll show you how to quickly fix this common WordPress error.
Let’s get started!
Main causes of 400 Bad Request Errors on WordPress
Errors 400 can have a multitude of reasons, but here are the most common ones:
Uploading a too big file
To protect bandwidth, many web servers (almost all of them) limit by default the size of the files your visitors can upload. When such an upload occurs, the server returns a 400 Bad Request error. Anyway, it’s best for security not to allow your user to upload heavy files on WordPress websites.
Sending a request to an invalid URL
Sending a request to an invalid URL (ie: with erroneous characters, malformed syntax, or illegal characters) can return a 400 Bad Request Error. This can happen so easily if you don’t encode your URL correctly.
Expired/wrong cookie
Sometimes your browser can store invalid or expired cookies. The server may perceive this cookie as dangerous and return the 400 Bad Request Error code.
Troubleshooting the 400 Bad Request Error Code on WordPress
Nota bene: Before trying to fix any HTTP error on WordPress, you should ALWAYS make a backup of your WordPress Website (FTP + Database).
Although it’s categorized as a client error, the 400 bad request error code if often at a crossroad between, the client, the server, and/or a web application. Determining the cause and fixing the 400 bad request error code on WordPress can thus be challenging.
This being said, the 400 bad request errors designate that the request sent by the client was invalid for some reason, so here is what you should do first if you are using WordPress: Make a backup!!!
Check the Solicited URL
Wrong URL strings are the most common reasons for a 400 Bad Request error. Check that there are no unwanted or illegal characters in the URL you typed in your browser. You also need to make sure they’re separated with adequate slashes.
Sometimes, URL has special characters such as %%% and this can lead to the 400 error. If this happens, you have to check that your WordPress website is encoded properly.
If you struggle with this, check out this amazing free URL Encoder & Decoder Tool for WordPress. When you think that you have a good URL structure, try to refresh the page. If it doesn’t work, go to the next step!
Clear your Web Browser Cache and Cookies
You may be surprised, but most 400 errors in WordPress can be fixed by clearing your browser’s cache and cookies.
Browser caches temporarily store images, scripts, and other parts of websites you visit to speed up your browsing experience. Some of the data stored can be expired and thus responsible for the 400 Bad Request Error. Clearing your browser cache and cookies might troubleshoot the 400 HTTP error code.
Clear Cache & Cookies Chrome
In Chrome, enter this address in your browser’s URL field: chrome://settings/clearBrowserData
You will directly access the clear browsing data dashboard.
In here, make sure that the “cached images and files“, and “cookies” boxes are ticked. Then click on the Clear data button. Refresh your page, if it doesn’t work, go to the next step!
Nota bene: On a Mac, you can refresh a web page and automatically clear its cache with the shortcut: SHIFT+CMD+R
Clear Cache & Cookies Mozilla
Click the menu button and select “Preferences” > Privacy & Security panel. You will lend here:
Tick the “Cookies and Site Data” and “Cached Web Content” boxes and click “clear data”
Log Out of your WordPress Account and Log In Again
If you have empty your browser cache and cookies, you have automatically been log out of WordPress. Try to log in again.
By doing so, you will refresh your credential and maybe get rid of the 400 Bad Request Error Code. If it doesn’t work, let’s go to the next step!
Diminish the size of the file you tried to upload
Many servers limit the size file for security reasons. If you’re facing the bad request error while uploading a file, try again with a much smaller file to see if this resolves the 400 error.
How to reduce file size?
- To reduce the image size, you can use a compression plugin like ShortPixel or a third party application like CompressJPEG.
- To reduce video size on WordPress, check out this amazing guide from WPMUDEV.
Clear your cache in WordPress
It’s highly unlikely, but the 400 Bad Request Error can also be triggered by your cache plugin. You might want to purge your cache to troubleshoot this error.
To clear the cache on WP Rocket you need to click here:
To purge the cache on WP Super Cache you need to click there:
Remove the last plugins you installed
Plugins and themes can enhance your WordPress website functionalities, but they can also generate PHP errors and trigger the 400 Bad Request Error Code.
Monitoring WordPress PHP error logs is a good way to detect the plugins that can slow and jeopardize your website. Removing one by one the last plugins you installed, might be a good way to fix the 400 bad request error.
If you want to see which plugins generate PHP errors look at WP Umbrella.
Downgrade your WordPress version
If you have updated WordPress just before the 400 bad request error showed up – and if none of the solutions we suggested you before worked – you may want to consider rolling back to the previous WordPress version you had installed when things were working just fine.
Final thoughts on the 400 bad request error code on WordPress
In most cases, the 400 Bad Request error is coming from the client side and is thus easy to fix. However, from time to time, this error can shed light on more problematic generic server issues.
If none of our tips and fixes worked, you should suspect the bad request error to be a server-side issue. In such a situation, you have to contact your web host provider.