Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Created September 27, 2018 13:56
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 Shelob9/10cebd4b5a7aae2e201825486a1f2916 to your computer and use it in GitHub Desktop.
Save Shelob9/10cebd4b5a7aae2e201825486a1f2916 to your computer and use it in GitHub Desktop.
<?php
/**
* Limit max upload size for Caldera Forms file fields
*/
add_filter( 'upload_size_limit', function( $size ) {
//Check if Caldera Forms submission
if( isset( $_POST, $_POST['_cf_frm_id'] ) ){
// 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;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment