Skip to content

Instantly share code, notes, and snippets.

@plusplugins
Last active October 31, 2015 11:50
Show Gist options
  • Save plusplugins/1d15795944eac4b4234b to your computer and use it in GitHub Desktop.
Save plusplugins/1d15795944eac4b4234b to your computer and use it in GitHub Desktop.
CMB2 Select2 Dropdown of Ultimate Member user fields
global $ultimatemember;
$options = array();
$fields = $ultimatemember->builtin->all_user_fields('date,time,url');
foreach ($fields as $key => $value) {
if ( isset($value['title']) ) {
$options[$key] = $value['title'];
}
}
$cmb->add_field( array(
'name' => __( 'Fields', 'pp' ),
'desc' => __( 'Select fields', 'pp' ),
'id' => $prefix . 'fields',
'type' => 'pw_multiselect',
'options' => $options,
) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment