Home › Forums › Backend Issues (wp-admin) › ACF Update multiple fields and multiple posts
I am trying to copy content from old flexible layouts to new flexible layouts. For example, I have two flexible layouts called image media and one called video media. They each have multiple fields such as gallery, title, description, etc. I created new a new media layouts within in the flexible content that I would like to copy all of this content over on several pages.
I would like to:
I have a successful PHP function that is however unreliable and I’m not sure if what I’m doing is the best way of doing what I need done. Here is a general summary of what I’m doing, I’m happy to post the full function if needed:
$wpdb
and get_posts()
array
for each page storing this dataACF update_field()
to update 67 pages in the loop aboveadd_action( 'acf/init', 'update_acf_image_section' )
The issue I’m having is that is sometimes creates duplicate layout rows and I’m not confident enough in this function to push to production. Any guidance would be greatly appreciated.
I am trying to copy content from old flexible layouts to new flexible layouts. For example, I have two flexible layouts called image media and one called video media. They each have multiple fields such as gallery, title, description, etc. I created new a new media layouts within in the flexible content that I would like to copy all of this content over on several pages.
I would like to:
I have a successful PHP function that is however unreliable and I’m not sure if what I’m doing is the best way of doing what I need done. Here is a general summary of what I’m doing, I’m happy to post the full function if needed:
$wpdb
and get_posts()
array
for each page storing this dataACF update_field()
to update 67 pages in the loop aboveadd_action( 'acf/init', 'update_acf_image_section' )
The issue I’m having is that is sometimes creates duplicate layout rows and I’m not confident enough in this function to push to production. Any guidance would be greatly appreciated.
You must be logged in to reply to this topic.
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!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz
— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.