Home Forums ACF PRO get_field returning wrong value


get_field returning wrong value

  • Hi,
    I have a strange issue with getting data from options page.

    I have 2 select fields
    1. Country
    2. Area

    In my options page I have list of countries and areas for each country.
    When user selects country, I get list of all areas for selected country from options page via AJAX, and then I populate second select.

    When I try to get a list inside my AJAX function like:
    $get_locations = get_field( ‘locations_area’, ‘options’ );

    Instead of array of areas I get number: 7 (there are 7 areas).

    Not sure why would this happen?


  • Looks like this started to happen after I have updated to ACF pro latest version.
    – I include ACF inside theme folder
    – As far I can see from DB, what I get returned as a value is field from options table ‘options_locations_area’
    So looks like the function for getting repeater field values is not loaded fully at this point.

  • If I’m reading this right and your field is a repeater field then you either need to use or the new

    What you are getting is the number of sub field rows in the repeater

  • Hi hume,

    thanks for answer, but this was not the problem.
    problem was when I used get_field to retrieve values, i got wrong values returned.
    it is on my localhost but somehow it works now, not sure what happen.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘get_field returning wrong value’ is closed to new replies.