Fix the 413 Request Entity Too large Error in WordPress

If you are trying to upload a theme or plugin file in WordPress and facing the 413 Request entity as too large an error, we are here to help. Also, if you are facing the same error but in different circumstances, you can still refer to this article. In this article, we will discuss all the possible causes of such types of errors along with the most popular fixes for them.

Causes WordPress 413 Request Entity Too Large Error:

Are you trying to upload a file on your WordPress site and facing the 413 request entity too large an error? Then the most probable cause could be that your file is exceeding the maximum file upload limit which is creating a hindrance for the web server in uploading your file.

The WordPress hosting companies, in general, have set configurations for uploading large images and other media files. But still, it is possible that a large theme or plugin file may exceed the set limit.

If a file is large enough to exceed the set limit for the large files, it would not get uploaded to the media library and in response, an error message will appear.

Resolving the 413 Request Entity Too Large Error in WordPress:

Step 1: Increasing the Upload File Size Limit sing the functions.php File:

  • Go to your theme’s functions.php file or a site-specific plugin.
  • Add the below code to it.

@ini_set( ‘upload_max_size’ , ’64M’ );

@ini_set( ‘post_max_size’, ’64M’);

@ini_set( ‘max_execution_time’, ‘300’ );

  • Set the values in upload_max_size and post_max_size as per your requirement.
  • Make sure that the set size is more than the file you are trying to upload.
  • Set the max_execution_time as the time required for the file to upload.
  • You can also double these values if you are not very sure about what values to put.

Step 2: Increasing the Upload File Size Limit via .htacces File:

If the above method fails and the error still persists, you can move ahead with this step.

  • Add the below code at the bottom of the .htaccess file.

php_value upload_max_filesize 64M

php_value post_max_size 64M

php_value max_execution_time 300

php_value max_input_time 300

Step 3: Manually Upload File via FTP:

If the above two method fails, you can check if the error appears for a specific file only. If this is the case, try to upload that file manually via FTP.