How to Increase the Maximum File Upload Size in WordPress

The WordPress file upload size is the maximum size of a file that can be uploaded to a WordPress site. This size is determined by the server settings and WordPress configuration settings, and it can be changed to accommodate larger or smaller file sizes.

By default, the maximum file upload size in WordPress is 2 MB to 150 depending on your web hosting settings. This size is sufficient for most uses, but it may not be enough if you want to upload large files such as videos or high-resolution images. In this case, you may need to increase the maximum file upload size in WordPress.

To increase the maximum file upload size in WordPress, you need to edit your WordPress site’s php.ini file and add the following code:

upload_max_filesize = 64M
post_max_size = 64M

In this code, the upload_max_filesize and post_max_size variables are set to 64M, which means that WordPress will allow file uploads up to 64 MB in size. You can increase or decrease this value depending on your specific needs and the capabilities of your server.

After adding this code to your php.ini file, you need to save the file and upload it to your server. This will apply the new file upload size settings to your WordPress site, and you should be able to upload larger files.

Increase Maximum File Upload Size Using PHP Code

Open the functions.php file in your WordPress theme’s folder using a text editor.

Add the following code to the functions.php file:

function increase_upload_size() {

    // Set the upload size limit to 100 MB 
    ini_set( 'upload_max_filesize', '100M' ); 
    ini_set( 'post_max_size', '100M' ); 
    ini_set( 'max_execution_time', '300' );

} add_action( 'init', 'increase_upload_size' );

Save the changes to the functions.php file and upload it to your WordPress theme’s folder.

Go to the Settings > Media page in your WordPress dashboard and check that the maximum file upload size has been increased to 100 MB.

You can adjust the upload size limit by changing the value in the ini_set() function in the code. For example, to increase the upload size limit to 200 MB, use the following code:

ini_set( ‘upload_max_filesize’, ‘200M’ ); ini_set( ‘post_max_size’, ‘200M’ );

Note: Increasing the maximum file upload size may affect the performance of your website, so use this method with caution and only increase the size limit if necessary.