Home › Forums › Feature Requests › 2 very important feature additions (PLEASE!!) › Reply To: 2 very important feature additions (PLEASE!!)
If we call that feature say “selective copying of field data” meaning you can select specific fieldtype, or fieldgroup, then yes I’d agree that’s more of an ACF-specific feature.
I think there might be a couple of different ways to do that but something like the process below would be needed:
1. Pass in the selection of fieldtypes, fieldgroups to the class, perhaps an arguments array like $args = array(‘fieldtypes’ => array( ‘repeater’ ));. Or a setter like $copyPost->setAcfFieldTypes( array(‘image’, ‘flex’) );
2. When looping over all meta data, load the field associated using the meta name to find the key. Then check if the fieldtype matches that array of fieldtypes to copy. Similar idea for fieldgroups, essentially find out if they that meta data item should be copied. Use continue to skip over meta that doesn’t match the criteria.
3. When matches are found, copy it the same as shown in that snippet using the queries.
Having to handle the data one item at a time might not be very efficient in terms of queries but it’s probably possible to delay the query until all the data has been organized.
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!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.