Created
September 27, 2018 13:56
-
-
Save Shelob9/10cebd4b5a7aae2e201825486a1f2916 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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