Support

Account

Home Forums General Issues update_field empty the field

Solved

update_field empty the field

  • Hi All.
    I’m trying to use the function update_field to update a gallery.
    I’m using this function:

    $gallery=serialize($imageArray);
    update_field(‘gallery’, $gallery, 2844);

    The array serialized seams to be correct but every time i execute the code, the function empty the field instead of filling it with the serialized array (or even text)

    Have you some suggestion?

    Thank you
    Tommaso

  • The problem is that you are serializing the array before you attempt to save it. This is not necessary. WP/ACF automatically does this when the value is saved. The value is getting double serialized.

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

You must be logged in to reply to this topic.