Skip to content

5 Methods to Increase the WordPress Upload Limit

Category: WordPress

Have you ever encountered an error saying "exceeds the upload limit" when trying to upload a media file in WordPress? The default upload limit in WordPress varies depending on the server environment, but in most cases it is set to 2MB–64MB. This article explains five methods to increase the upload limit with code examples.

Note: Always back up before making configuration changes. Also, some methods may not be available on shared hosting.

Effective limit = min of all layers nginx client_max_body_size e.g. 64m php.ini post_max_size e.g. 64M php.ini upload_max_filesize e.g. 32M WP_MEMORY_LIMIT (wp-config) e.g. 256M → Effective limit: 32 MB (smallest)
Diagram: configuration layers determining WordPress upload limit

Check current limit

First, let's check the current settings. The current upload limit is displayed on the WordPress admin screen's "Media" → "Add new media file" page. You can also check the values of upload_max_filesize and post_max_size in the "Tools" → "Site Health" → "Info" → "Server" section.

Method 1: Configure in wp-config.php

This is the easiest method. Add the following line to wp-config.php in the WordPress root directory.

// wp-config.php に追加(「編集が必要なのはここまでです」の行の上に記述)
@ini_set('upload_max_filesize', '64M');
@ini_set('post_max_size', '64M');
@ini_set('max_execution_time', '300');
@ini_set('max_input_time', '300');

This method uses PHP's ini_set(), so it may not be reflected depending on the server configuration. In particular, it has no effect in environments where these values are fixed in php.ini.

Method 2: Configure with .htaccess

If you are using an Apache server, you can override PHP settings in the .htaccess file. Add the following to the .htaccess file in the WordPress root directory.

# .htaccess に追加
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
php_value memory_limit 256M

With Nginx servers, .htaccess cannot be used, so you must handle this in the server configuration file.

# Nginx の設定(/etc/nginx/conf.d/ 配下)
client_max_body_size 64m;

Method 3: Configure with php.ini

If you can directly edit the server's PHP configuration file, this is the most reliable method. Write the following in php.ini (or .user.ini).

; php.ini に追記
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
max_input_time = 300
memory_limit = 256M

On shared hosting, you may not be able to directly edit php.ini. In that case, creating a .user.ini file in the WordPress root directory and writing the same content may take effect.

Note: Set post_max_size to a value larger than upload_max_filesize. post_max_size is the limit for entire form data, including form fields and overhead in addition to the file itself.

Method 4: Configure with functions.php

This is a method to add a filter to the theme's functions.php. Since settings are lost when the theme is updated, we recommend implementing this using a child theme or custom plugin.

// functions.php または カスタムプラグインに追加
@ini_set('upload_max_filesize', '64M');
@ini_set('post_max_size', '64M');

// WordPress のアップロードサイズフィルター
add_filter('upload_size_limit', function($size) {
    return 64 * 1024 * 1024; // 64 MiB
});

// マルチサイトの場合
add_filter('upload_size_limit', function($size) {
    return 64 * 1024 * 1024;
}, 20);

Method 5: Configure with hosting panel

Many rental servers and hosting services allow you to change PHP settings from their control panels (such as cPanel, Plesk, ConoHa, and Xserver).

  1. Log in to the hosting control panel
  2. Look for the PHP configuration or php.ini settings menu.
  3. Change the values of upload_max_filesize and post_max_size
  4. Save the settings and restart PHP if necessary

This method is the most reliable because the configuration is applied at the server level, ensuring it cannot be overridden by other methods.

Checkpoints when settings are not applied

  • Did you restart the web server (Apache/Nginx)?
  • If you're using PHP-FPM, did you restart PHP-FPM as well?
  • Check if CDN or Reverse Proxy Limits Request Size
  • In WordPress multisite, network admin settings may take precedence
  • Is post_max_size greater than or equal to upload_max_filesize?

Testing After Configuration Changes

After changing upload limits, always test with actual files. DevLab provides test files of various sizes.

Summary

There are multiple ways to increase the WordPress upload limit, but the applicable method depends on your server environment. First try configuring it in your hosting panel; if that's not available, use .htaccess or php.ini. After making configuration changes, verify that uploads succeed using DevLab's test files.

❓ Frequently Asked Questions

How do I check the WordPress upload limit?
The current limit is shown on Media → Add New Media File in the admin. You can also read upload_max_filesize and post_max_size under Tools → Site Health → Info → Server.
What is the most reliable way to raise the WordPress upload limit?
Changing the PHP settings from the hosting panel — cPanel, Plesk, Xserver and the like. Applied at server level, nothing else can override it. If that is unavailable, .htaccess or php.ini is the next most dependable route.
What is the difference between upload_max_filesize and post_max_size?
upload_max_filesize caps one file; post_max_size caps the whole form submission, including the form fields and the multipart overhead on top of the file itself. post_max_size must be greater than or equal to upload_max_filesize.