How can I limit the file size for uploads?

This works with the help of the following code in functions.php:

function filter_site_upload_size_limit( $size ) {
  if ( ! current_user_can( 'manage_options' ) ) {
    $size = 1024 * 4000; // max. 4 MB
  }
  return $size;
}
add_filter( 'upload_size_limit', 'filter_site_upload_size_limit', 20 );
Without cookies
This website does not use cookies or tracking. More information can be found in the privacy policy.