Set maximum file upload size for media attachments using htaccess
There are quite a few different methods to set a maximum file upload size for media attachments. The maximum attachments limit can be set either through apache using the .htaccess file or via the wp-config.php file which resides in the root of your server. Make sure though to use only one method at the same time.
In this post, We will show you how to define a maximum size limit for your WordPress media files using .htaccess. First, copy the snippet bellow and paste it at the bottom of your .htaccess file. Then, update the parameters of attachments Size and Timeout according to your preferences.
As you can see, We are setting here the maximum attachment size to 4MB and the timeout to 120 (2 minutes).
If you couldn’t set up the maximum size limit through the .htaccess file successfully, try using the wp-config.php method.