Support

Account

Home Forums Front-end Issues Google Map field returns NULL

Solving

Google Map field returns NULL

  • I’m struggling to get google maps working. I’ve set the field up in the field group. And entered a lat/long location on the edit page section. I see the map in the admin area.

    I’m 99% sure I’ve got the google api (with key) and the jquery-based js file loaded correctly. I’ve entered some console.logs in the script just to see where the script is running.

    I think I’ve isolated the problem to the $location variable returning NULL after var_dumping it into a pre element. What’s a bit strange is the first time I did it, it returned an empty string. I then changed the field name to something totally unique, and it then changed to returning NULL.

    The $location is set to be = to get_field(‘field_name’) as usual. I’ve also placed a simple text field on the same page, which works just fine.

    What else can I do to troubleshoot?

  • If ACF is returning NULL for a field it means that the field in not set, there’s nothing in the database.

    There isn’t enough information to help more than that. My best guess is that you’re somehow using the wrong field name. How is the field set up? Is it a sub field of a repeater or a top level field?

  • Thanks for the response. I’ve check the field name many times :). It’s the same. What does it mean that I can see the map in the admin area?

    It’s a top-level field.

    What does it indicate when ACF returns and empty string?

  • If there is an empty string then usually that means that the post was saved with the acf field but no value was entered. So if the field name is correct then there must be some other reason why it’s not returning a value.

    Where is the field group located? post, options page, somewhere else?

    Where is the code for getting the field? Inside “The Loop” or outside?

    Have you tried disabling other plugins or switching themes? There has been a rash of topics started lately about the divi theme and it’s data/time script breaking ACF.

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

You must be logged in to reply to this topic.