Support

Account

Home Forums Add-ons Gallery Field Why do I need a "duplicate" field in the DB?

Helping

Why do I need a "duplicate" field in the DB?

  • Why do I need both these rows in the postmeta table for the gallery to work in the front end?

    rows

    Specifically, what is the 2nd row needed for?

    Scenario: I needed to scrape HTML from another site, so I used update_field() to add images the ACF gallery straight in the DB (as per the method http://old.support.advancedcustomfields.com/discussion/5564/programmatically-add-images-to-gallery-field/p1). Until I added the 2nd row manually, the ACF gallery in the admin worked but would return false when called using get_field().

  • For others that may be looking for this information, since I know it’s a very old topic. The second row that you’re asking about is required so that ACF knows with to return. As you can see, the first row contains a serialized array. Without the second value ACF will return an array of attachment IDs, the second row tells acf that it’s a gallery field and to return an image arrays for each of those IDs.

    All ACF fields are the same. The only fields that will work properly without the second entry in the database are fields that store simple text values.

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

The topic ‘Why do I need a "duplicate" field in the DB?’ is closed to new replies.