Skip to content

Instantly share code, notes, and snippets.

@mikejolley
Created April 2, 2015 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikejolley/5fe3ff4e9a069b1d3c1c to your computer and use it in GitHub Desktop.
Save mikejolley/5fe3ff4e9a069b1d3c1c to your computer and use it in GitHub Desktop.
Limit max upload file size for non-admin users
add_filter( 'upload_size_limit', 'limit_upload_size_limit_for_non_admin' );
function limit_upload_size_limit_for_non_admin( $limit ) {
if ( ! current_user_can( 'manage_options' ) ) {
$limit = '1000000'; // 1mb in bytes
}
return $limit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment