How to Fix 400 Bad Request Error in WordPress?
If you are using WordPress, you might have come across the 400 bad request error. This is a common error that you might have come across. Here is where we will see how to fix 400 bad request error in WordPress.
We will first see why this error occurs and then we will move on to the ways to fix it.
Why 400 Bad Request Occurs?
Bad Request simply means that there is something wrong with the client (in most cases). If the server can’t determine the error type, it falls into the 400 error. Generally, it is caused when the client makes the mistake.
It is not specific to any browser or OS. In simpler words, it might occur in Google Chrome or Mozilla Firefox too. There is no specific browser. One thing is that the same error might not be occurring for all the websites.
So, there are good chances that it client’s mistake and not the servers.
Now that you know about the error and why it is caused, let’s jump into the ways to fix it.
There are various reasons why this error might occur. We can’t name it specifically that this is the reason for the error. To solve it, we will have to try all the methods one by one. One of them will surely work and will give you the solution to the problem.
Therefore, you will have to try all of them to see which one is for you.
Check the URL
This is the most common mistake that people make which causes this error. The easiest way to fix 400 bad request errors in WordPress is to check the URL that you are visiting.
URL is the biggest mistake that you might see here. This happens especially when you are running any campaign which includes signs.
So, you need to make sure that the URL is correct. There could be small URL errors such as an unwanted sign or you might have added space in between or some sign that is not allowed in the URL.
This happens a lot when you have clicked a link trough a third-party refers. You need to add “?” before you start writing the campaign and the reference details. Such small mistakes can change the request.
Therefore, you can try by removing the extra slug and just typing in the URL. If the main domain name works and a particular URL doesn’t work, it might be URL’s mistake and not the server’s mistake.
Cookies and Cache
One of the reasons why this error occurs might be your computer’s fault. You can simply check out the cookies and cache of your computer.
The simplest way will be to open the website or the URL in incognito mode. If the webpage works fine in the incognito mode, it is the cookies or cache memory that is giving the problem. You can simply remove the cookies and cache memory from your browser. You can also try using it in a different browser.
Alternatively, you can “click ctrl + shift + f5” altogether to see if it is working fine. This will reload the page without any cache memory. So, you don’t have to open incognito mode to see the changes.
If this is not the issue, the next reason will be the server-side cache. If you are using one of the cache plugins on your website, then this might occur.
All you can do is purge all the cache on your website and see if the error occurs again or not. In most cases, it will be gone and you will be able to open the URL. It is that simple.
Even if this doesn’t work, you can try disabling or deactivating the cache plugin for a while to see if the problem is fixed or not. You can surely activate it again if it doesn’t solve the problem.
Cache memory is usually the primary cause of such problems assuming it has nothing to do with your browser.
So, we saw that it could either be your browser’s cache memory that is giving issues or it might be the server’s cache memory. You can try it both to see if it works or not.
File too Large
If you are uploading a file and you see this error than the simple reason for the error could be the file size. If the file you are uploading is too large, WordPress will show you 400 error.
Therefore, you can either try uploading a small file or you can increase the memory of WordPress. It might sound like a big deal but it surely isn’t. You can do it with ease.
You will have to head over to your cPanel to do this. It can’t be directly done through the WordPress dashboard.
So, open your file manager and look for the wp-config.php file. It will be in your WordPress directory. You won’t have to open any folder to find it.
Once you are there in the file, open the file and add the following code inside it.
You can either right-click on the file and select “code edit” to edit the file or you can download the file, open it in Notepad++ or any editor, edit the file and then upload it again on the server. Either way, you just have to add the above given one line inside it.
This code will simply increase the default memory to 256 MB which will allow huge files to execute. Please note that there might be some limit set by your host if you are not using standard hosting. However, most of them allow 256 MB. Therefore, you can add the code and try to reload the page again to see if the error is solved or not.
If not, it is because the file is corrupted (only applies if you are getting this error while uploading a file).
Recreate the Permalinks
Sometimes the .htaccess file might be corrupted which might be giving this issue. To solve it, you will need to recreate the permalinks on your WordPress website. It will be impossible to create all the links. So, we will use a simple trick to regenerate all the links.
All we will do is fix the .htaccess file. For that, we will first have to head over to the WordPress dashboard and go to Settings > Permalinks.
Once you open it, don’t do anything and just hit the save button without making any change. This will recreate all the links and you are done.
Thereafter, you can open the URL again and see if it is still showing the same thing or not. If you’re not able to open the homepage, you can simply enter the admin panel and it will open the admin page. Usually, this error is for a particular page and not for the entire website. So, don’t worry, and directly open one of the admin panels. It will work like charm.
However, if this method doesn’t work, we have got one more method for you that will surely work. This is for the people who can’t even open the admin panel.
Rollback the Changes
If you recently changed any plugin or code, this might be the issue. For example, if you recently installed any plugin in your system, this might be giving the issue.
You can try deactivating the plugin or you can rollback the entire change that you made. This could be anything from activating a plugin to change a theme.
Most people even suggest you deactivate all the plugin and activate them again. However, you won’t have to necessarily do that here.
Just rolling back the changes will be enough procedure that you can do to see if it is causing the issue. However, if nothing works, you can surely try deactivating all the plugins. This will surely work.
You can also try renaming the plugin folder in WordPress directly. It will automatically deactivate all the plugins. You can then name it back again if it starts working. The same applies to the theme. Instead of changing the folder name of the theme, you can change the theme name itself. Thereafter, if it starts working, you can start using the same theme again.
Not to mention, you can also delete the plugin if you want.
To conclude, these are some of the best ways you can try to fix 400 bad request error in WordPress. For most people, it will be either the cache memory or the memory limit. You can try all of the methods in sequence as given here. We have made sure that we tell you the most common method first and then go to the advanced method. There will be very few people who will have to go to the last method. Most of you will get the error solved just by trying 2 or 3 methods from here. Don’t forget to check the website again to see if it is working or not.