Home Forums Add-ons Gallery Field Convert Attachments to Gallery Reply To: Convert Attachments to Gallery

  • Hi John,

    Thanks for replying.

    I’ll just repeat the critical part:
    Convert Attachments to Gallery:
    “I have 160 posts from about 5 years ago with existing galleries generated from attachments before wordpress started using gallery item IDs.”

    When I say “galleries” I don’t mean WP_galleries because they didn’t exist (using IDs) pre 3.5 They are purely the attachments with common post_parent. They were either uploaded directly to the post using “add media” or “attached” using a utility called file gallery which is not user friendly to say the least – hence the need for changing to a better system. I am currently showing either (attachments) or (acf gallery) depending on the post using an if statement.

    I can see a few people have created galleries programatically from an array of image IDs (example above). I think all i need help with is generating the _gallery meta_value.
    “using update_field() just not sure how to create the field programatically.”

    Can you help with that?