Skip to content

Instantly share code, notes, and snippets.

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 yuriinalivaiko/b32bdb957d0b603637771a06f8a006bb to your computer and use it in GitHub Desktop.
Save yuriinalivaiko/b32bdb957d0b603637771a06f8a006bb to your computer and use it in GitHub Desktop.
Hook um_custom_dropdown_options_source__{$form_key}
<?php
/**
* Hook: um_custom_dropdown_options_source__{$form_key}
*
* Type: filter
*
* Description: Change custom dropdown options source by $form_key.
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-fields.php#L3114
* @link https://docs.ultimatemember.com/article/1093-umcustomdropdownoptionssourceformkey
*
* @package um\core
* @see um\core\Fields::edit_field()
* @since 2.0
* @version 3.0
*
* @param string $source Dropdown options source.
* @param array $data Field data.
*
* @return string Dropdown options source.
*/
function my_custom_dropdown_options_source( $source, $data ) {
// your code here.
return $source;
}
$form_key = 'role';
add_filter( "um_custom_dropdown_options_source__{$form_key}", 'my_custom_dropdown_options_source', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment