Are you getting a 413 error on your WordPress site? It can be frustrating but there are a few simple ways to resolve the 413 error message. The error comes up when you try to upload a file that is larger than your hosting accounts upload limit. This error specifically shows up if you try to upload a theme, plugin or media file through the WordPress Dashboard in your web browser.
What Causes the 413 Error in WordPress?
When you try to upload a file that is larger than your upload limit you’ll either see the ‘Request Entity Too Large’ error or possibly ‘HTTP Error’ if you’re using the Media upload feature in WordPress. Your upload limit is set by your web hosting provider but you can override the default values using a few different methods.
How to Fix the 413 Error Message in WordPress
In order to fix the 413 error message in WordPress you will need to edit your functions.php file. This file is located in the /wp-content/themes/ directory. Once you’re in this directory you would go inside the folder of your theme. You can use the File Manager inside cPanel or use an FTP program to navigate to the themes directory.
Before you proceed to edit the functions.php file you should make a backup copy of the file. I cannot stress this enough. Making a backup of the file will allow you to quickly and easily revert any changes if you’ve made a mistake.
Once you’re in the theme folder, locate and open the functions.php file. You need add the following 3 lines of code to into your themes functions.php file:
@ini_set( ‘upload_max_size’ , ’128M’ );
@ini_set( ‘post_max_size’, ’128M’);
@ini_set( ‘max_execution_time’, ‘300’ );
The code above increases your upload limit for WordPress to 128MB and allow up to 300 seconds (5 minutes) for execution. You can adjust these values based on the file size you’re trying to upload. Do not increase them to excessive values though. You may need to ask your web host what they allow but 128MB should be more than enough for media content and theme uploads. Once you have added the code you can save the file. The changes are instant and you should now be able to upload large files in WordPress.
If you do not have access to the functions.php file don’t worry! There is an alternative method to increase the upload limit to resolve the 413 error.
Editing Your .htaccess File To Fix The 413 Error
The htaccess method is similar to the functions.php method but in this case you need to edit your websites .htaccess file. The .htaccess file is located in your public_html folder. You can edit the .htaccess file using either the File Manager in cPanel or using an FTP program such as FileZilla.
Simply copy and paste the following lines of code into the .htaccess file:
php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_execution_time 300
php_value max_input_time 300
Once you’ve pasted the code above in your .htaccess file save the changes. You should now be able to upload larger files in WordPress!
I’m Still Getting The Error!
Since every web hosting company has a different server setup the two methods mentioned above may not fix the 413 error. If the solutions above did not solve the error your first step should be to contact your web host. They will be able to set your upload limits for you.
If you use CloudFlare for your website then I recommend you disable it entirely. CloudFlare has their own upload limits and if your traffic is passing through their CDN they may be blocking your uploads even after you’ve made the changes described above. Once you disable CloudFlare you will need to wait up to 24 hours for your domains DNS to propagate. After 24 hours you can test your WordPress upload and it should be resolved.
The solutions described today should work with any version of WordPress.
Leave a comment and let us know how you fixed the 413 error on your WordPress website!