How to Increase the Max Upload Size in WordPress - Ayush Shrestha || UI/UX || Front-end || Angular || React || Wordpress

How to Increase the Max Upload Size in WordPress

To increase the maximum upload file size in WordPress, you typically need to adjust the following PHP settings: upload_max_filesize, post_max_size, and max_execution_time. Here’s how you can do it:

  1. Editing php.ini File:
    • Locate your php.ini file. This file might be in your server’s root directory, or it could be in a folder like /etc/php/7.x/.
    • Open php.ini in a text editor.
    • Find the lines that specify upload_max_filesize, post_max_size, and max_execution_time.
    • Increase their values to the desired limits. For example:
    • Save the changes and restart your web server.
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
  1. Editing .htaccess File:
    • If you don’t have access to php.ini, you can try editing your .htaccess file.
    • Add the following lines to your .htaccess
    • Save the changes.
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
  1. Using Theme Functions File or Plugin:
    • You can also increase the maximum upload size using your theme’s functions.php file or via a custom plugin.
    • For functions.php, you can add the following code:
    • If you prefer using a plugin, there are several plugins available in the WordPress repository that allow you to modify these PHP settings from the WordPress dashboard, such as “Increase Max Upload Filesize”.
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );

After making any of these changes, your WordPress site should now allow larger file uploads. Remember that some web hosts may have additional restrictions, so if these methods don’t work, you may need to contact your hosting provider for assistance. Additionally, increasing these limits might consume more server resources, so make sure your hosting environment can handle it.

Leave a Reply