Limit the Maximum Upload Size
Caps the size of files that can be uploaded through WordPress at 8 MB, even if the server allows more.
Opens WPIDE on
Code
add_filter( 'upload_size_limit', function ( $bytes ) {
return min( (int) $bytes, 8 * MB_IN_BYTES );
} );
Notes
This can only lower the server limit, not raise it.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.