Skip to content

Instantly share code, notes, and snippets.

@mvaneijgen
Created October 21, 2017 10:30
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 mvaneijgen/4db072899ae54ef7469519b50f5ddacc to your computer and use it in GitHub Desktop.
Save mvaneijgen/4db072899ae54ef7469519b50f5ddacc to your computer and use it in GitHub Desktop.
<?php
function limit_upload_file_size( $file ) {
// Check if upload field is ACF file
// Get max upload file size
// Set max upload file size to max upload file size of field
// else
// Max upload file size === 300kb
// endif
return $file;
}
add_filter ( 'wp_handle_upload_prefilter', 'limit_upload_file_size', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment