Support

Account

Forum Replies Created

  • under FIELD GROUPS I have:

    Name: FRESH SNOW SKI RESORTS”
    Key: group_647d9f906d00a

    In the above group I have FIELDS:

    Name: FS SKI RESORT DATA (and it is defined as a group
    Key: field_64b38c4e3ec56

    In above, I have many sub fields but the one that is not working is;

    Field Name: qgis_aa_zoom
    Key: field_64c782fc4c55d
    Numeric

  • Per the first post, I have echoed out the values being applied to the update_field() function and they are correct.

    I have tried this, too:

                if (update_field('field_64c782fc4c55d', 2, '1074')){
                    
                    echo "Success - ";
                    echo 'field_64c782fc4c55d: '.get_field(field_64c782fc4c55d, 1074);
                    echo '</br>';
                }

    As expected, it will not update is I keep 2 in there more than once. If I change 2 to another number, update_field is executed and the value of field_64c782fc4c55d is updated and get_field returns the updated value.

    I then go to the view of my custom post type and the value is never update. For instance, if I update the via the view of field field_64c782fc4c55d and I enter 7, the number never changes despite executing the above code.

    So then it means the view is not right. I inspected the html and it shows;

    <div class="acf-input-wrap"><input type="number" id="acf-field_64b38c4e3ec56-field_64c782fc4c55d" name="acf[field_64b38c4e3ec56][field_64c782fc4c55d]" value="7" step="any"/></div></div>
    </div>

    The id is acf-field_64b38c4e3ec56-field_64c782fc4c55d which is myFieldGroupName-FieldKey

    Is that the way it should be working? There is not a description in the man pages and I would hate to start digging through the ACF code.

  • When I call update_field(), I call it using ajax as follows

    add_action('wp_ajax_get_myFunction', 'myFunction');

    I would have thought that if update_field() is indeed firing, the ACF libraries would have loaded, no?

  • This is getting weirder and weirder and beginning to think there is a bug somewhere.

    Here are two field I have:

    Key: field_64c782fc4c55d
    Name: qgis_aa_zoom
    Group: fs_ski_resort_data

    Key: field_64a54023795f5
    Name: fs_aa_zoom
    Group: fs_ski_resort_data

    I have tried the most basic code as follows to update;

    update_field('field_64c782fc4c55d', 12, 1074);

    If I go to my custom posts and look at the field, it is empty, however, if I do this;

    echo 'field_64c782fc4c55d: '.get_field(field_64c782fc4c55d, 1074);

    I get 12, as updated above. Bizzare.

    I have an API that calls the field by name, rather than key as follows;

    `$fs_ski_resorts_data[$i][‘fs_ski_resort_aa_zoom’] =
    get_field(‘fs_ski_resort_data_fs_aa_zoom’) ?:
    get_field(‘fs_ski_resort_data_qgis_aa_zoom’); `

    Above produces: "fs_ski_resort_aa_zoom": "", // empty string

    If I manually insert data via the view of my custom post type, say, 7, I get this;

    "fs_ski_resort_aa_zoom": "7",

    So there seems to be something going on in the database and things are not matching correctly.

    Any help appreciated.

  • Thank you and then I understand the fields are am trying to update are not sub fields. Wonder if there is any other debugging I can do to help understand why my fields are not getting updated?

  • btw, all the fields are part of a group. The those fields considered sub fields? There are no repeater fields.

  • @John Huebner
    hoping you may have some ideas for me to try. Thank you as always!

  • The data I am trying to update are sub fields in a group.

    I see there is the following function;

    update_sub_field($selector, $value, [$post_id]);

    I have tried below but it also doesnt work.

    update_sub_field(field_64c782fc4c55d, 84, 1074);

  • Yes, I get that, however, the fields are not updated. There is not much debugging info other that it do not succeed. I echod out the update_field values and all seems correct.

    Any ideas?

  • btw, all the fields are part of a group. Does that make a difference? I know using field names the field group must be pre-concantonated with the field name. I assume using the key, this is not required as the key is guaranteed to be unique.

  • @John Huebner I very much appreciate your detailed replies. This has cleared up my misunderstanding. Thank you!

  • BTW, null mean no value, however, how about “” (empty string). That will count as a value, correct?

  • Thank you for your help. I missed that part in the man page.

    I reviewed how I am updating records. This is how I am doing it;

    update_field($acf_field_name, $value, $post_id);

    The man page says $acf_field_name is the field name or field key.

    Now I see later in the man page, it says under “Updating via Field Key”,

    The field’s key should be used when saving a new value to a
    post (when no value exists). This helps ACF create the correct
    ‘reference’ between the value and the field’s settings.

    So only if the field has an existing value, can I use the acf name? If there is no value, (eg NULL), then I must use the KEY instead? Am I correct in saying that if one doesnt know if the field contains a value or not, then best to ALWAYS use the KEY?

    May I suggest an update to the man page at the top where it says, “is the field name or field key” to read “is the field name or field key, however, when updating new values, a KEY must be used instead of the name (see more below)”.. or something like that?

    BTW, I have fields in groups. For names I would need to concantenate group-name with field-name. I assume with fields, no need to do that, right?

    Thank you again.

  • You ticket systems is freaking out. I get blocked when I try to add info. Now I just wrote a couple paragraphs and all gone.

    Do you have an email I can write to please?

  • Interesting. This is the record BEFORE I go to the backend and hit update.

    {
    “osm_geometry”: “way/955280979”,
    “fs_ski_resort_name”: “牧の入高原スノーパーク”,
    “fs_ski_resort_name_en”: “Makinoiri Kogen Snow Park”,
    “fs_ski_resort_landuse”: “winter_sports”,
    “fs_ski_resort_sport”: “downhill”,
    “fs_ski_resort_lit”: null,
    “fs_ski_resort_email”: null,
    “fs_ski_resort_phone”: null,
    “fs_ski_resort_fax”: null,
    “fs_ski_resort_addr_full”: null,
    “fs_ski_resort_postal_code”: null,
    “fs_ski_resort_contact_website”: “https://makinoiri.com/&#8221;,
    “fs_ski_resort_contact_facebook”: null,
    “fs_ski_resort_contact_twitter”: null,
    “fs_ski_resort_wikidata”: null,
    “fs_ski_resort_wikipedia”: null,
    “fs_ski_resort_aa_winter_sports_sq_km”: “0.74”,
    “fs_ski_resort_aa_pistes_length”: “5660”,
    “fs_ski_resort_aa_lifts_length”: “2520”,
    “fs_ski_resort_aa_pistes_count”: “12”,
    “fs_ski_resort_aa_lifts_count”: “4”,
    “fs_ski_resort_aa_min”: “610”,
    “fs_ski_resort_aa_max”: “891”,
    “fs_ski_resort_aa_novice_length”: “0”,
    “fs_ski_resort_aa_novice_count”: “0”,
    “fs_ski_resort_aa_easy_length”: “0”,
    “fs_ski_resort_aa_easy_count”: “0”,
    “fs_ski_resort_aa_intermediate_length”: “0”,
    “fs_ski_resort_aa_intermediate_count”: “0”,
    “fs_ski_resort_aa_advanced_length”: “0”,
    “fs_ski_resort_aa_advanced_count”: “0”,
    “fs_ski_resort_aa_expert_length”: “0”,
    “fs_ski_resort_aa_expert_count”: “0”,
    “fs_ski_resort_aa_freeride_length”: “0”,
    “fs_ski_resort_aa_freeride_count”: “0”,
    “fs_ski_resort_aa_extreme_length”: null,
    “fs_ski_resort_aa_extreme_count”: null,
    “fs_ski_resort_aa_zoom”: null,
    “fs_ski_resort_aa_y”: “36.8143696397”,
    “fs_ski_resort_aa_x”: “138.3968575196”,
    “fs_ski_resort_aa_mean”: “192.00350194703”,
    “fs_ski_resort_aa_pitch”: null,
    “ZOOM”: null
    },

    This is the output after I hit the UPDATE button. The info is sitting populated in the input boxes. Strange.

    {
    “osm_geometry”: “way/955280979”,
    “fs_ski_resort_name”: “牧の入高原スノーパーク”,
    “fs_ski_resort_name_en”: “Makinoiri Kogen Snow Park”,
    “fs_ski_resort_landuse”: “winter_sports”,
    “fs_ski_resort_sport”: “downhill”,
    “fs_ski_resort_lit”: “”,
    “fs_ski_resort_email”: “”,
    “fs_ski_resort_phone”: “”,
    “fs_ski_resort_fax”: “”,
    “fs_ski_resort_addr_full”: “”,
    “fs_ski_resort_postal_code”: “”,
    “fs_ski_resort_contact_website”: “https://makinoiri.com/&#8221;,
    “fs_ski_resort_contact_facebook”: “”,
    “fs_ski_resort_contact_twitter”: “”,
    “fs_ski_resort_wikidata”: “”,
    “fs_ski_resort_wikipedia”: “”,
    “fs_ski_resort_aa_winter_sports_sq_km”: “0.74”,
    “fs_ski_resort_aa_pistes_length”: “5660”,
    “fs_ski_resort_aa_lifts_length”: “2520”,
    “fs_ski_resort_aa_pistes_count”: “12”,
    “fs_ski_resort_aa_lifts_count”: “4”,
    “fs_ski_resort_aa_min”: “610”,
    “fs_ski_resort_aa_max”: “891”,
    “fs_ski_resort_aa_novice_length”: “0”,
    “fs_ski_resort_aa_novice_count”: “0”,
    “fs_ski_resort_aa_easy_length”: “0”,
    “fs_ski_resort_aa_easy_count”: “0”,
    “fs_ski_resort_aa_intermediate_length”: “0”,
    “fs_ski_resort_aa_intermediate_count”: “0”,
    “fs_ski_resort_aa_advanced_length”: “0”,
    “fs_ski_resort_aa_advanced_count”: “0”,
    “fs_ski_resort_aa_expert_length”: “0”,
    “fs_ski_resort_aa_expert_count”: “0”,
    “fs_ski_resort_aa_freeride_length”: “0”,
    “fs_ski_resort_aa_freeride_count”: “0”,
    “fs_ski_resort_aa_extreme_length”: “”,
    “fs_ski_resort_aa_extreme_count”: “”,
    “fs_ski_resort_aa_zoom”: “15”,
    “fs_ski_resort_aa_y”: “36.8143696397”,
    “fs_ski_resort_aa_x”: “138.3968575196”,
    “fs_ski_resort_aa_mean”: “192.00350194703”,
    “fs_ski_resort_aa_pitch”: “85”,
    “ZOOM”: “15”
    },

Viewing 15 posts - 26 through 40 (of 40 total)