Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Shelob9/90dabafd7b03e0a6cceb6bb391f94ebc to your computer and use it in GitHub Desktop.
Save Shelob9/90dabafd7b03e0a6cceb6bb391f94ebc to your computer and use it in GitHub Desktop.
<?php
add_filter( 'caldera_forms_private_upload_directory', function( $directory, $field_id, $form_id, $transient_id ){
//IMPORTANT -- Change this to the ID of your field, or remove this conditional to affect all fields.
if( 'fld111' === $field_id ){
//see: https://developer.wordpress.org/reference/functions/wp_get_upload_dir/
$uploads = wp_get_upload_dir();
$directory = $uploads[ 'basedir' ] . '/somepath';
}
return $directory;
},10,4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment