Title: degami's Replies | WordPress.org

---

# degami

  [  ](https://wordpress.org/support/users/degami/)

 *   [Profile](https://wordpress.org/support/users/degami/)
 *   [Topics Started](https://wordpress.org/support/users/degami/topics/)
 *   [Replies Created](https://wordpress.org/support/users/degami/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/degami/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/degami/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/degami/engagements/)
 *   [Favorites](https://wordpress.org/support/users/degami/favorites/)

 Search replies:

## Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin] Registration field – Dropdown and parents](https://wordpress.org/support/topic/registration-field-dropdown-and-parents/)
 *  [degami](https://wordpress.org/support/users/degami/)
 * (@degami)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/registration-field-dropdown-and-parents/#post-9635306)
 * [@timafeo](https://wordpress.org/support/users/timafeo/) – glad you got it (mostly)
   working.
    [@roosalles](https://wordpress.org/support/users/roosalles/) – agreed:
   great plugin, wish it had better developer docs.
 * I’m afraid I never properly resolved the issue and couldn’t get the field to 
   display on the front-end. But, I did eventually create a stupidly complex workaround…
 * Ultimate member has a field type ‘shortcode’ that lets you add the output of 
   a WordPress shortcode into the form. So, I created a [custom shortcode (link to gist)](https://gist.github.com/dave-mills/3fe2309cae97b41b1658127ae5a8fd64)
   to display any piece of user metadata I wanted.
 * Then, I added a shortcode field just below the field with the choices callback,
   and used my `[USERMETA meta='cities']` shortcode. I set this new field to only
   display on view, to give one field that lets the user update the city value in
   Edit mode and one field to display the city in View mode.
 * But, the shortcode doesn’t display a nice field header like other fields do, 
   so I also added a “Content Block” field to act as a header.
 * (Actually, my first attempt was to put the shortcode directly into the Content
   Block, but it that didn’t parse the shortcode properly. I guess this is why they
   have a separate Shortcode field-type.)
 * So the final workaround has 3 fields – the original dropdown select field with
   the choices callback, a shortcode to display the value on the front end, and 
   a content block to give the value a header. Kinda ridiculous, but it works! (
   Until they fix the issue in an update and I’m left with duplicated fields everywhere…
   haha)
 * ~D
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin] Registration field – Dropdown and parents](https://wordpress.org/support/topic/registration-field-dropdown-and-parents/)
 *  [degami](https://wordpress.org/support/users/degami/)
 * (@degami)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/registration-field-dropdown-and-parents/#post-8816906)
 * Hi,
 * I’m also exploring the choice callback feature and have found very little documentation.
   In case you’re still looking (or if someone else follows this path), I’ll add
   what I’ve learned here:
 * It appears you need to write your own callback function and put it into the `
   functions.php` script of your theme. The function needs to return an array, and
   I found that a key-value pair array gave me the most control over the options
   that are returned.
 * I managed to get a simple example working with 2 dropdown fields:
    1. “countries”–
   just a standard dropdown field with options predefined 2. “cities”: – Choices
   Callback = “getCities” – Parent = “cities”
 * Then, I added my getCities callback to my child-theme’s functions.php file:
 * [(gist link)](https://gist.github.com/dave-mills/8dbaaffbfb016fcf4a9f8ecc50e89e5e)
 * The $cities array is returned, and my field “cities” is populated with the options
   from that array.
 * The issue I now have is that I can’t get my field with a Choice callback to display
   on my profile page – the field’s visible in edit mode, and saves correctly to
   the wp_user-meta table of the database, but won’t show in ‘view’ mode. I’ve double
   checked the “visibility” option for the field, and it’s set to View Everywhere.
   As soon as I remove the choice callback and parent field, it’s visible. Anyone
   know of a solution to this?
 * ~D.
    -  This reply was modified 9 years, 6 months ago by [degami](https://wordpress.org/support/users/degami/).
      Reason: fixed gist link

Viewing 2 replies - 1 through 2 (of 2 total)