High-quality content is the recipe for a successful website. Without engaging content, you won’t be giving many reasons for your audience to stay on your site, leading to a high bounce rate. You need to make sure your articles are engaging. That includes adding media – images and videos, to enhance your posts.
If you’re using WordPress, there’s a limit to how big an uploaded file can be, restricting freedom on an otherwise powerful platform. If you try to upload a file that exceeds the size limit, you will see an error message like the one below. Annoying, right? Luckily, there are four simple methods that can increase the WordPress upload size limit that I will cover in this article. Let’s check them out!
WordPress Upload Size Limit
There are a few things you need to know before starting to use any of the methods.
Not all WordPress sites have the same upload size limit – it can range from 2 MB to 150 MB. If you want to see what’s yours, head to your dashboard and go to Add New -> Media and take a look at the bottom left.
The number depends on the hosting provider you’re using as they are the ones who set the limit. That’s because large files put a heavy load on the server. So, the limit is there to prevent your site from getting slowed down.
4 Easy Methods to Increase WordPress Upload Size Limit
We are going to bring a little bit of code into play. But don’t worry, it’s very simple.
Here’s how the snippet looks like:
upload_max_filesize = **M post_max_size = **M Max_execution_time = **
As you can see, there are three different lines that play different roles in increasing the WordPress upload size limit. Let’s break each one down:
- Upload_max_filesize. The value that determines how large the files you want to upload can be.
- Post_max_size. This is the line that sets the maximum size allowed for a single post or page that you want to publish. If upload_max_filesize only dictates the limit for a single file, then post_max_size sets the overall size allowance for the files AND the included post or page data. So, if you increase upload_max_filesize, you should increase the limit for this line too.
- Max_execution_time. When you upload something, you also send a PHP request to the database to execute a task. This line dictates the maximum time (in seconds) allowed for the server to perform said task. So, you have to increase this as well, as larger files take longer to load.
Now we can put this knowledge to use. There are four ways you can increase the WordPress upload size limit, namely:
- Modifying your theme’s function.php file.
- Editing .htaccess.
- Configuring your PHP settings.
- Using a plugin.
In the next section, I will guide you through each method.
1. Modifying Your Theme’s function.php File
You need to access the function.php file contained in your theme package. It can be done through your WordPress dashboard interface. Simply go to Appearance -> Editor. The sea of code that you’ll see is the style.css file of your theme. Don’t do anything there! Instead, go to the function.php file listed on the right panel.
Then, add the following code. You can define the value with any number you want.
@ini_set( 'upload_max_size' , '128M' ); @ini_set( 'post_max_size', '200M'); @ini_set( 'max_execution_time', '450' );
Click Update File to save it. If you see a message “File edited successfully”, then you’re done. Simple, right? The only drawback to this is that you have to repeat the process every time you change your theme. If you’re constantly changing themes, this method may not be ideal for you.
2. Editing .htaccess
Here’s a little introduction to what the .htaccess file is – it’s a server configuration file that governs the activation of specific features, including the WordPress upload size limit.
It’s located in the root folder of your WordPress installation. To locate it easily, you will need access to your control panel and the file manager tool. Alternatively, you can use an FTP client.
Once you’re in the control panel, look for the File Manager. In the file manager, the .htaccess file will be in the root directory. Once you find it, Edit the file. The file manager’s integrated text editor will show up. Don’t copy the code just yet because there are two additional lines of code you must insert when using this specific method – max_input_time and memory_limit.
Did you ever get a “timeout” error? If you have, it’s because the value for max_input_time is not big enough to process the files.
That line defines the amount of time allowed for a single PHP script to parse input data. The purpose of this limit is to make sure there will be no PHP scripts that run too long, slowing down your site.
If you wish to set it to unlimited, set the value to 0. Otherwise, if you wish to upload large files, we suggest you set the value (in seconds) to a relatively safe number to avoid the timeout error.
As for the memory_limit, you need to set the value to be bigger than post_max_size. This line defines the size limit carried by a single PHP script.
With that out of the way, use the snippet example below and add it to your .htaccess file.
php_value upload_max_filesize 128M php_value post_max_size 200M php_value memory_limit 300M php_value max_execution_time 450 php_value max_input_time 300
Your file should look similar to this: Now, click Save & Close to finish editing. Let’s move on to the third method.
3. Configuring Your PHP Settings
The process for this method is very similar to the previous one, requiring you the access your site’s control panel and modify the php.ini file.
Note that it’s not the same for every hosting provider – each may have different kinds of control panels. For the ones using cPanel, you can simply go to Select PHP Version -> Switch to PHP Options. Here, you can easily set the limit with the help of the dedicated forms.
4. Using a Plugin
The three methods above require you to change some technical elements on your site – which may be uncomfortable for people with little technical knowledge. If you prefer a more convenient way, you can rely on a plugin called Increase Max Upload File Size.
It’s a lightweight plugin that does exactly what you need without fuss. After you install the plugin, simply navigate to its settings on your WordPress dashboard. As you can see, it doesn’t give you any other option than to change the maximum WordPress upload size limit. This makes it an ideal solution for those who prefer the most straightforward method.
It comes with a big drawback, though. You can only change the limit that was set by WordPress, not by your hosting provider. You can check both limits in the plugin’s interface. If the limit set by your hosting provider is too small, you need to change it via one of the three other methods.
Let’s Raise The Limit!
You should have full control over your site, and easily get the most out of WordPress’ capabilities.
Luckily, raising the WordPress upload size limit is easy and won’t take much of your time. Let’s overview the four methods once again:
- Modifying your theme’s function file. You can add the code that defines the upload size limit to the theme’s core file. But you need to re-insert the code each time you start using a new theme.
- Editing .htaccess. You can modify the file on your site’s root directory to override the upload size limit. Simply open it via the file manager on your hosting provider’s control panel, and insert the code there.
- Configuring PHP settings. You need to look for the PHP configuration menu on your control panel. This way, you can change the limit without adding a single line of code.
- Using a plugin. This method only takes a few simple clicks and allows you to change the value from the comfort of your WordPress dashboard. The only drawback is that you can’t change the limit defined by your hosting provider.
All in all, that’s all there is to know about increasing the WordPress upload size limit. Just remember that big files may slow down your site. Optimize the files first before uploading them. Happy blogging!