{"id":3203875,"date":"2012-11-19T20:28:04","date_gmt":"2012-11-19T20:28:04","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/feature-request-array-data-for-select-and-radios\/"},"modified":"2016-08-20T17:50:05","modified_gmt":"2016-08-20T17:50:05","slug":"feature-request-array-data-for-select-and-radios","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/feature-request-array-data-for-select-and-radios\/","title":{"rendered":"Feature Request &#8211; Array data for select and radios"},"content":{"rendered":"<p>Hi! <\/p>\n<p>Can you include an option to use an array as data source for select fields and other multiple choices?<\/p>\n<p>Instead of type in the values for options, can you create a field where i type the name of a custom function that returns an array with data, and use the function as source for the field (select)?<\/p>\n<p>e.g:<\/p>\n<pre><code>\/\/in functions.php\n\nfunction my_custom_data()\n{\nreturn array(\narray(&#039;label&#039;=&gt;&#039;my_label_1&#039;, &#039;value&#039;, &#039;my_value_1&#039; ),\narray(&#039;label&#039;=&gt;&#039;my_label_2&#039;, &#039;value&#039;, &#039;my_value_2&#039; ),\n);\n}<\/code><\/pre>\n<p>Type: Select<br \/>\nData: my_custom_data<\/p>\n<p>thank you!<\/p>\n<p>https:\/\/wordpress.org\/extend\/plugins\/advanced-custom-fields\/<\/p>\n","protected":false},"template":"","class_list":["post-3203875","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3203875","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3203875\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=3203875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}