There are a lot of people discussing how to increase the php max upload file size...
In my case though I want to shrink it from 8MB to 4MB... In my cpanel configuration, if I change the setting, it will eventually change it for all the websites hosted... which is something I don't want (on some other wordpress install I need 8).
I tried placying a php.ini in the user/public_html root where my WP installation is, but no change. If I try placing rules in .htaccess I get an internal server error
is there a way to tell wordpress to set the limit of uploadable files below the php limit? I tried to look if there was such setting in wp-config but haven't found it
thanks
ps - I'm seeking for an advice for single site installations, I'm aware that multisite has the feacture I need... but on single site it's not there
EDIT
I've found this filter which prevents the user to go further if tries to upload an image (any file actually) above a specified size
function custom_file_max_upload_size( $file ) {
$size = $file['size'];
if ( $size > 3000 * 1024 ) {
$file['error'] = __( 'ERROR: you cannot upload files larger than 3M', 'textdomain' );
}
return $file;
}
add_filter ( 'wp_handle_upload_prefilter', 'custom_file_max_upload_size', 10, 1 );
after $size you can enter the size in bytes 3000 * 1024 = 3M
this is almost what I want to achieve, except for one thing: the Wordpress Media upload still displays the 8M limit which is the PHP limit. I wish I could get rid of that, otherwise the users of my website may get confused.