Custom Field Suite
[resolved] Get Field's Type and Choices (for select) (3 posts)

  1. consumedesign
    Posted 3 years ago #

    Is there a way to get for example a particular field group by ID then get it's type and if a select their "Choices" with a API method?


  2. logikal16
    Plugin Author

    Posted 3 years ago #

    Yes and no.

    There's a get_input_fields API method that retrieves all field information within a given field group. It's not really intended to be directly accessed (it could change in time), but to use it:

    $choices = array();
    $group_id = YOUR_FIELD_GROUP_ID;
    $field_name = YOUR_SELECT_FIELD_NAME;
    $field_info = $cfs->api->get_input_fields($group_id);
    foreach ($field_info as $field) {
        if ('select' == $field->type && $field_name == $field->name) {
            $choices = $field->options['choices'];
    // Output the choices
  3. consumedesign
    Posted 3 years ago #

    Cool thanks I'll give it a try. BTW, LOVE the plug in... great job.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Field Suite
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic