How to decrease the file size upload limit?

The answer to this questions depends on the level of access you have to your server. Shared hosts often limit the options you have. Your options are:

1) Changing a directive in your php.ini: Heres how to find it.

This will change the setting for all websites using php on this server. Many shared hosts don’t allow this.

Find the line in that says upload_max_filesize and edit it to look like the following:

upload_max_filesize = 500K

2.a) Setting an ini directive in the .htaccess file (if you use apache):

In the .htaccess file in the WordPress root directory (where the wp-config.php file is) add the following on a new line:

php_value upload_max_filesize 500K

This will change the setting for that installation of WordPress only.

Be aware, many shared hosts will not allow this. Additionally this will only work if you are using PHP as an apache module and AllowOverride is set to “Options” or “All” more info here.

2.b) With a .user.ini file:

Much like .htaccess above, a .user.ini file is used to override directives at a directory level. This will only work if your server is using the CGI/FastCGI SAPI. So if you’re on Azure App Service/IIS or something similar this is probably what you want.

Syntax is: upload_max_filesize = 500K

3) Changing the directive in WordPress with ini_set():

This should work on a shared host.

Add the following line to your functions.php:

ini_set( 'upload_max_size' , '500K' );

This works by changing the setting every time this file is run. functions.php is run on every load when the theme is active so this effectively changes the limit when using your theme.

Bonus: WordPress Multisite

Navigate to Network Admin > Settings > Network Settings. You should see the setting close to the bottom of the page. However, the maximum limit you can set here is dictated by the other PHP settings outlined in the this answer.

error code: 523