Home › Forums › Bug Reports › issues related to field key references › Reply To: issues related to field key references
yes. we are using the field_name within our app/importer. The reason for this is because we have several environments (e.g. dev. / staging / production) where the field_keys are not guaranteed to be the same on each system. We also have hundreds of ACFs defined. This is why the lookup is so important.
anyways, the important issue with regards to my OP is that the workaround, whereas we populated the reference ‘_text’ with a value of ‘text’ (as an example) and ‘text’ had a proper value in it, was working fine with wordpress 3.5 but then stopped working properly in conjunction with the wordpress 3.7.1 upgrade.
specifically with regards to radio buttons in which the get_field_object() function appears to be prepending ‘field_’ to the value that is stored in the reference (in this example ‘_text’)
so, let’s use the following example:
meta_key = ‘radio_button’, meta_value = ‘pick me!’
meta_key = ‘_radio_button’, meta_value = ‘radio_button’
get_field_object() is returning ‘field_radio_button’ for the value of ‘_radio_button’ meta_key. it should be returning ‘radio_button’ as the value of the ‘_radio_button’ meta_key, but it’s prepending ‘field_’ and thus the actual values are not being properly returned as an object. (and subsequently as a result the [‘choices’] array element does not exist within the returned object)
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
ACF wouldn’t be so widely used in WordPress if it didn’t have some pretty amazing capabilities. In this article, we look at a few of the features we’ll discuss during “7 things you didn’t know you could do with ACF” at #WPEDecode later this month. https://t.co/5lnsTxp81j pic.twitter.com/Yf0ThPG1QG— Advanced Custom Fields (@wp_acf) March 16, 2023
© 2023 Advanced Custom Fields.