Fixing the 413 Request Entity Too Large Error for WordPress

What Causes the Request Entity Too Large Error?

A common issue that WordPress users come across is the “413 Request Entity Too Large” error. In this tutorial, we’ll cover how to fix this common, and easy-to-fix issue.

This error normally occurs when WP users attempt to upload media, themes, plugins, or other files that exceed the maximum file upload settings for your server.

There are multiple methods to fix the request entity too large error in WordPress depending on your server setup. We’ll cover the three primary methods in this tutorial below:


Method 1- Update the Upload File Size Limit via Functions.php

Simply add the following code to your theme’s function.php file or a code manager such as the CodeSnippets plugin.

@ini_set( ‘upload_max_size’ , ‘128M’);
@ini_set( ‘post_max_size’, ‘128M’);
@ini_set( ‘max_execution_time’, ‘300’);

If needed, feel free to increase the values in upload_max_size and post_max_size to be greater than the file you are attempting to upload. You may also need to increase “max_execution_time” for larger files.


Method 2- Increase Upload File Size Limit via .htaccess (Apache servers)

Simply open and edit the .htaccess file and add the following code at the bottom:

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300


Method 3. Manually Upload File via FTP

If the error occurs when you are uploading one particular file consistently, then you could try uploading the file via FTP. Once completed, make sure to clear any cache (if applicable), and try uploading your file again and see if you still get the error.


For Nginx Servers & Users

Nginx uses the client_max_body_size setting to control the maximum size of the client request body. NGINX users will need to access their nginx.conf file and edit the settings manually.

Once you open your nginx.conf file, you can add the following lines as shown in the example below:

# set client body size to 128M #
client_max_body_size 128M;

Save and close the file. Then, reload the Nginx server with this command:

nginx -s reload

Refund Reason