Home › Forums › Add-ons › Gallery Field › Convert Attachments to Gallery › Reply To: Convert Attachments to Gallery
Moving from one way of doing things to another is never an easy process.
WP holds gallery shortcodes in the content area where ACF stores galleries in a separate field. There really isn’t an automated way that you can convert from one of these to the other. Not that it isn’t possible, but because it would be time consuming and will probably time out the site if you try to do it on a page load. You need to look in the content of every post, see if there is a gallery, see what images are in it (are they all the attached images or selected ones), update the ACF field that should now hold the gallery and then delete the gallery currently in the content editor.
The best way to do this would be to leave those galleries alone and build the new one using ACF and then in the template file that show them to build conditional logic that can use either one of them depending on what’s found in each post. Still complicated, but doable.
My choice would probably be to not do anything as long as the old galleries are still working or there is some really good reason that it needs to be converted. Any way you look at it this will be a fair amount of work because, like I said, it’s not something that can really be automated, or at least not easily, which is likely why you can’t find anything that does it.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
❓Ever wondered when and why ACF uses JSON instead of the database? Check out our summary of the most recent session of ACF Chat Friday for the answer, and make sure to register for the next session.— Advanced Custom Fields (@wp_acf) February 23, 2023
© 2023 Advanced Custom Fields.