JDM Digital

How to Increase Max Upload Size in WordPress

Sometimes you want to upload things to your WordPress website that are greater than 2 MB in size. Here are three ways to increase that max upload file size limit.

First off, let’s check to see what the current maximum upload limit for your WordPress website is.  Go to Media >> Add New and look for the value under the “Upload New Media” box.

If you were to try and upload a file larger than that “Maximum upload file size” you’ll get an error.

NOTE:
If at all possible, you shouldn’t be uploading massive files (videos, animated GIFs, etc) to your site anyway.  It can slow your site down.  Also, some shared web hosting providers set limits even these tricks won’t get around.  Just sayin’.

There are three ways we can increase that number.  Let’s take a quick look at them all.

Via Functions.php

In your theme’s functions.php file, add the following lines of code to increase your max upload to, say, 32 MB.

@ini_set( 'upload_max_size' , '32M' );
@ini_set( 'post_max_size', '32M');
@ini_set( 'max_execution_time', '300' );

You’ll see we’re also increasing the max_execution_time so we give our web server a little extra time to process these larger images or we’ll get timeout errors.

Via PHP.ini

Access your site using an FTP client and look for a file in the root directory named php.ini. Add the following code to that file.

file_uploads = On
post_max_size = 32M
upload_max_filesize = 32M
max_execution_time = 300

If you don’t see a php.ini file in the root directory, you could try creating one.

Via HTaccess

Access your site using an FTP client and look for a file in the root directory named .htaccess. Add the following code to that file OUTSIDE of the WordPress comments.

php_value upload_max_filesize 32M
php_value post_max_size 32M
php_value max_execution_time 300
php_value max_input_time 300

Again, if you’re on shared hosting, these may not work. In that event either try and lower that number from 32MB to something like 10MB or contact your web hosting provider.

Get the Email

Join 1000+ other subscribers. Only 1 digest email per month. We'll never share your address. Unsubscribe anytime. It won't hurt our feelings (much).

Subscribe

Exit mobile version