Limit the files upload size in WordPress using wp-config php file
Limiting your files upload size in WordPress sometimes might come in handy to improve the quality and the security of your WordPress website.
Defining the attachments size limit can be achieved using different methods. Among these, you can use the .htaccess file or you can insert a PHP code snippet into your wp-config.php file which is located in your website’s root. Please use only one of the mentioned solutions and not both at a time.
In order to define the size limit for your media library files via wp-config.php. First, use your favorite code editor to open your wp-config.php. Then insert the snippet bellow somewhere at the end of the file. Finally, do not forget to change the limit number to adjust the snippet to your preferences.
As you can see, We are setting here the maximum file size to 4MB. In your case, you would probably increase it or decrease it depending on the size of your files.
If you do not want te mess with your wp-config.php file to limit your files upload size you can try the .htaccess code snippet. Are using a better method to get the same results? If so, do not hesitate to tell us about it.