Skip to content

Instantly share code, notes, and snippets.

@jondcampbell
Created January 4, 2016 23:01
Show Gist options
  • Save jondcampbell/b067210252e4ee48c143 to your computer and use it in GitHub Desktop.
Save jondcampbell/b067210252e4ee48c143 to your computer and use it in GitHub Desktop.
CMB2 File List: Don't show media from other posts. The key is the query_args that tell the media uploader to only show the resources uploaded to post 99999999999 (which I hope never exists).
$this->cmb_form->add_field( array(
'name' => 'Resource File List',
'desc' => '',
'id' => $this->cmb_prefix . 'resource_files',
'type' => 'file_list',
// 'preview_size' => array( 100, 100 ), // Default: array( 50, 50 )
'attributes' => array(
'required' => true, // Will be required only if visible.
'data-conditional-id' => $this->cmb_prefix . 'resource_type',
'data-conditional-value' => 'files',
),
'query_args' => array(
'uploadedTo' => 99999999999,
),
) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment