Custom Fields
Support Meta Box Builder Dot notation for MB Geolocation "type"

  • Creator
  • #15993
    Resolved pza

    I may be missing something obvious, but I've tested and searched on here to no avail.

    Here's what I'm trying to do:
    - Using MB Builder + MB Geolocation, set the "Types" option to return 2 types. Like in the example on the MB Geolocation docs, I would like to set it to "(cities)" and ""establishment"

    'geo' => array(
        'api_key' => 'YOUR API KEY',
        'types' => array( '(cities)', 'establishment' )

    How can I do that in the Settings tab of MB Builder?

    I tried adding a custom attribute of geo.types => [{"establishment","(cities)"}]

    But on the front end I get the following error:

    InvalidValueError: setTypes: not an Array
    _.Wc @ js?libraries=places&key=AIzaSyDgNeQLcJwxuVJC8yC_F1HYfXONXoTVaxc&ver=5.2.2:60

    Can this be done with MB Builder + Geolocation?

    Thanks for your help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
  • #16001
    Anh Tran

    Hi pza,

    Please set as follows:

    • geo.types.0 = (cities)
    • geo.types.1 = establishment

    I tried this also but no results show in autocomplete. Perhaps it's just not valid to pass two arguments here? For my purposes address will work for now. Thanks Anh.


    @pza I use JSON syntax and it seems to work fine.

    On your custom attribute (in your original post) you're creating an object inside an array:

    I tried adding a custom attribute of geo.types => [{"establishment","(cities)"}]

    But it just needs to be an array with two values: ['establishment','(cities)'] (no inner curly brackets)


    Ohh, I feel silly now. Thank you!


    Just an update that my solution to set a square bracket array... I thought it was working, but realized it's not now and maybe never was!

    So best to stick with Anh Tran's answer #16001 (he's always the best person to trust anyhow 🙂)

    geo.types.0 = (cities)
    geo.types.1 = establishment

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.