• vsulako

    (@vsulako)


    “Url” and “open in new tab” fields do not save.

    version: 2.9

    Reason: assets/js/acf-photo-gallery-field.js (lines 161-167):

    var form = $(this).serializeArray();
    ...

    form.push({name: "acf_field_name", value: acf.getField(form.acf_field_key).data.name});

    serializeArray() creates indexed, not associative array, so form array does not have acf_field_key property, form.acf_field_key is undefined,acf_field_name field in ajax request gets incorrect value and url/target saves incorrectly.

    Possible fix:

    replace lines 161-167 with:

        var form = $(this).serializeArray();
        var post_id = acf.get('post_id');
        var attachment_id = form.find(x => x.name === "attachment_id")?.value;
    
        var acf_field_name=acf.getField(form.find(x => x.name === "acf_field_key")?.value).data.name; //change
    
        form.push({name: "action", value: "acf_photo_gallery_edit_save"});
        form.push({name: "post_id", value: post_id});
        form.push({name: "nonce", value: apgf_nonce});
    
        form.push({name: "acf_field_name", value: acf_field_name}); //change



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