function limit_user_file_upload_size( $size ) {
// Set the upload size limit to 10 MB for users lacking the 'manage_options' capability.
if ( ! current_user_can( 'manage_options' ) ) {
// 10 MB.
$size = 1024 * 10000;
}
return $size;
}
add_filter( 'upload_size_limit', 'limit_user_file_upload_size', 20 );
Related Keywords: Developer, How-to, Solved, WordPress Upload Size Limit
