You have probably seen upload max filesize WordPress error ( upload_max_filesize ) at least once while operating your WordPress website. It’s a very common error and it can be easily fixed. WordPress has bound size limits depending on the platform where you’re hosted it. another hand, The default upload file size for WordPress is two MB, that could be a problem if you wish to upload large media files or install plugins and themes. So you need to know that there is more to fix the Maximum Upload File Size in WordPress.
In this article, we will explain to you how to easily improve the maximum file upload size in WordPress to adjust those issues. In total, we’ll cover:
1. Changing a WordPress file
This way works in a few cases. You simply require to add the next code in the theme functions ( functions.php ) file.
@ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' );
In older versions of WordPress, it was hard fixed at 256MB and wasn’t possible as a global variable that could be set in the wp-config.php file.
define('WP_MEMORY_LIMIT', '512M'); define('WP_MAX_MEMORY_LIMIT','512M');
2. php.ini Option
PHP has several configuration options. By default, PHP is set to permit uploads of files with a size of 2MB or smaller. The php.ini file contains parameters required for file timeout, upload size, and resource limits. Access your WordPress root directory using cPanel, SSH or FTP and look for a php.ini file. In some facts, this file is not apparent to all. If you do not view one, then create a file named php.ini and upload it in the root folder.
upload_max_filesize = 64M // This defines the maximum upload limit for files. post_max_size = 64M // This defines the maximum upload limit that will be handled in a POST request. max_execution_time = 300 //This defines how much memory is allocated for PHP. This number should be equal or higher than the upload_max_filesize.
3. Create or Modify .htaccess
As a result, the editing of PHP.ini file didn’t work, then you could edit your .htaccess file to resolve this issue. The .htaccess file is a unique hidden type file that carries various settings of the server behavior.
This is the very easier way to fix the problem and it’s the most common method for shared hosting. in WordPress. Edit the .htaccess file in your WordPress site’s root folder and attach the next code:
php_value upload_max_filesize 64M php_value post_max_size 64M php_value max_execution_time 300 php_value max_input_time 300
4. Right of the Platform
By the time, Some WordPress hosting providers alike hostgator has a pre-built-in feature to update the file size limit. Here is a demo, how you can do it directly from the cPnael.
5. Using Plugin
If you don’t like to do it manually, there is a plugin existing in the WordPress repository called Increase Maximum Upload File Size. You just need simply install the plugins and used them. The plugin automatically recognizes upload limits set by WordPress and by the server/hosting provider and represents them.
However, we must emphasize that if you are on a shared hosting package, then these techniques may not operate. In that case, you would have to reach your web hosting provider to improve the limit for you.
We expect this article helped you increase the maximum file upload size in WordPress.