Skip to content

How to Change the WordPress Upload Limit

Five ways to raise the WordPress media upload limit. Pick the one that suits your server environment and hosting provider.

Effective limit = min of all layers nginx / Apache (proxy) client_max_body_size php.ini post_max_size whole POST php.ini upload_max_filesize per file WP_MEMORY_LIMIT (wp-config) PHP memory Each layer applies top-down. The smallest is the effective limit.
Diagram: configuration layers determining WordPress upload limit

Check the current limit

The WordPress admin shows "Maximum upload file size" on Media → Add New, and the Info tab of Site Health lists the underlying PHP values. Out of the box, WordPress usually inherits a PHP limit somewhere between 2 MB and 10 MB.

The effective limit is the smallest of these three settings.

  • upload_max_filesize — the maximum size of a single file
  • post_max_size — the maximum size of the whole POST request; it must exceed upload_max_filesize
  • memory_limit — the memory ceiling available to PHP

Method 1: edit wp-config.php

The quickest option: add this single line to wp-config.php in the WordPress root.

@ini_set('upload_max_filesize', '64M');

This has no effect if the host has disabled ini_set; in that case try another method. For something more dependable you can also use define as shown below.

define('WP_MEMORY_LIMIT', '256M');

That raises the WordPress memory ceiling but does not by itself change the upload limit. Combine it with one of the methods below.

Method 2: edit .htaccess (Apache)

On an Apache server running mod_php, add the following to .htaccess in the WordPress root.

php_value upload_max_filesize 64M
php_value post_max_size 128M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300

Note: where PHP runs as CGI or FastCGI — which covers most shared hosting — .htaccess cannot change PHP settings, so this method does not apply. If you get a 500 error, remove the lines you added.

Method 3: edit php.ini or .user.ini

Editing the PHP configuration directly is the most reliable way to change these values, provided you have the access to do it.

In php.ini

upload_max_filesize = 64M
post_max_size = 128M
memory_limit = 256M
max_execution_time = 300
max_input_time = 300

In .user.ini (for shared hosting)

If your host does not let you edit php.ini directly, create a .user.ini file in the WordPress root with the same contents. It can take minutes to hours to take effect.

upload_max_filesize = 64M
post_max_size = 128M
memory_limit = 256M

Method 4: add a filter in functions.php

Add a filter hook to the theme's functions.php. It helps when you cannot change PHP itself, but it can never exceed the server-side PHP settings.

@ini_set('upload_max_filesize', '64M');
@ini_set('post_max_size', '128M');
@ini_set('memory_limit', '256M');
@ini_set('max_execution_time', '300');
@ini_set('max_input_time', '300');

Alternatively, set the limit through a WordPress filter.

add_filter('upload_size_limit', function($size) {
    return 64 * 1024 * 1024; // 64MB
});

Note: this only changes the WordPress-side limit. If PHP's own upload_max_filesize is smaller, PHP wins.

Method 5: change it in your host's control panel

Most Japanese hosting providers let you change PHP settings from their control panel. This is the safest and most dependable route.

Xserver

  1. Sign in to the server panel
  2. Choose PHP → php.ini settings
  3. Select the domain
  4. Open the php.ini settings tab
  5. Set upload_max_filesize and post_max_size to the values you want
  6. Click through the confirmation and apply the change

ConoHa WING

  1. Sign in to the control panel
  2. Site management → Site settings → Advanced settings
  3. Change upload_max_filesize under PHP settings

Sakura Internet

  1. Sign in to the control panel
  2. Script settings → php.ini settings
  3. Change the values and save

Testing after the change

Once you have changed the settings, upload a genuinely large file and confirm the behaviour. DevLab's threshold test files let you test the exact boundary of the limit you configured.

Test case What to look for
A file below the limit (63 MB if you configured 64 MB)It should upload without trouble
A file exactly at the limit (64 MB)Confirm whether it succeeds or fails
A file over the limit (65 MB)A clear error message should appear

Troubleshooting

  • The change does not take effect: you may need to restart the web server (Apache or Nginx) and the PHP process.
  • You get a 500 error: check .htaccess for typos or directives the server does not support.
  • You get a 413 error: on Nginx, check client_max_body_size as well — it lives in nginx.conf.
  • Timeouts: large uploads also need higher max_execution_time and max_input_time.

❓ Frequently Asked Questions

I changed the setting but the limit did not move.
If any one value is still small, that value is the effective limit. Check in this order: upload_max_filesize and post_max_size in php.ini, then client_max_body_size or LimitRequestBody on the web server, then the ceiling in your host's control panel. On shared hosting the php.ini change itself is sometimes configured to be ignored.
Should I use functions.php or wp-config.php?
Neither is guaranteed to override the PHP ini settings; the server-side configuration is what actually works. functions.php is lost when you switch themes, so wp-config.php is at least the safer of the two. Fundamentally though this belongs in php.ini, .htaccess or the host's control panel — treat the WordPress-side lines as a last resort.
What is the best way to upload a large video?
Rather than raising the limit, the right answer is not to put video in WordPress at all. Files of several hundred MB strain PHP's memory and execution time and make backups heavy. Hosting on YouTube, Vimeo or object storage such as S3 and embedding removes the limit problem entirely and delivers faster. If it truly must live on your server, place it over FTP or SSH and only register it in the media library.