Are you struggling with uploading large files to your WordPress website? Fear not, as we have got you covered! In this article, we will guide you on how to increase the maximum file upload size in WordPress, giving you the freedom to upload larger files to your site.
There are three methods you can use to increase WordPress’ maximum file upload size:
- Modifying the .htaccess file
If your hosting provider allows you to change PHP settings via the .htaccess file, you can use this method to increase the upload limit. To do this, access the WordPress root directory through an FTP client or File Manager, open the .htaccess file, and add the following code at the bottom of the file:
php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_execution_time 300
php_value max_input_time 300
- Configuring the php.ini file
This method is more suitable for WordPress sites with VPS hosting, as shared hosting providers may not allow you to edit the php.ini file. To increase the maximum file upload size by configuring the php.ini file, access the WordPress root directory via FTP client, File Manager, or SSH (if supported), then open the php.ini file. If you cannot find the file, create one under the same name and filetype in the root directory, and add the following code:
upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 300
- Editing the functions.php file
You can also increase the maximum file upload size by modifying your theme’s functions.php file. However, please note that this modification will revert to default if you change your site’s theme. To do this, navigate to Appearance -> Theme Editor from your WordPress dashboard, open the theme functions file (functions.php), and add the following code:
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );
Why Increase the Maximum File Upload Size?
By default, WordPress provides a built-in media uploader, saving you time as you don’t have to connect with FTP clients or use a File Manager from your hosting provider. However, the PHP-based uploader has an upload limit for maximum file size. This limit may vary depending on your hosting provider and WordPress configuration. To check your WordPress upload file limit, navigate to Media -> Add New from the administrator dashboard.
Increasing the maximum file upload size allows you to upload larger files to your site, which may be necessary for various reasons. For instance, you may need to upload high-quality videos, large images, or other media files that exceed the default upload limit. Without increasing the upload limit, you may encounter ‘the uploaded file exceeds the upload_max_filesize directive in php.ini’ error when attempting to upload larger files.
Conclusion
Increasing the maximum file upload size in WordPress can be done in multiple ways, including modifying the .htaccess file, configuring the php.ini file, or editing the functions.php file. While these methods are relatively easy to follow, you should always check with your hosting provider before attempting to make any changes to your site’s settings. We hope this article has been helpful in increasing your WordPress upload file size limit.