Upon debugging we found the wp_max_upload_size
function was returning 1MB. The u_bytes
and p_bytes
were as expected and equal to 100MB as defined in our uploads.ini
file but the application of upload_size_limit
filter changed the size to 1MB i.e., the problem was at:
return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );
A upload_size_limit_filter
is defined in wp-includes/ms-functions.php
and is wired up to execute only for a multisite installation. (the wiring code is in wp-includes/ms-default-filters.php
. The filename has a ms
prefix standing for multisite):
// this function runs only for a multisite installation of wordpress
function upload_size_limit_filter( $size ) {
$fileupload_maxk = KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 );
if ( get_site_option( 'upload_space_check_disabled' ) ) {
return min( $size, $fileupload_maxk );
}
return min( $size, $fileupload_maxk, get_upload_space_available() );
}
and tracing the code path we found that fileupload_maxk
equalled 1536000
and so this is what was causing the issue. The fileupload_maxk
value is fetched from MySQL.
Continuing, we could see this in MySQL DB. The wp_sitemeta
table only exists for a multisite installation:
mysql> select * from wp_sitemeta where meta_key = 'fileupload_maxk';
+---------+---------+-----------------+------------+
| meta_id | site_id | meta_key | meta_value |
+---------+---------+-----------------+------------+
| 7 | 1 | fileupload_maxk | 1500 |
+---------+---------+-----------------+------------+
1 row in set (0.00 sec)
and so the fix for this problem is to update this value. It can be done using wp-cli as follows. We are using a multisite installation so have to use wp site
command:
bash-5.0# wp site option update fileupload_maxk 10000 --allow-root
Success: Updated 'fileupload_maxk' site option.
This updates the entry in MySQL and the issue is fixed. In short, it seems that the fileupload_maxk
does not seem to be well known. None of our Google searches on original query led us to it. Here is another answer on SO that talks about fileupload_maxk
.