AdvancedCustomFields / acf

Advanced Custom Fields
http://advancedcustomfields.com/
868 stars 180 forks source link

Mass Post Creation with Automated Field Creation & Population Possibility? #157

Open prodjallen opened 5 years ago

prodjallen commented 5 years ago

I've currently written a PHP script which generates near 1M posts for WP from my db, to an import file, with page info as in post title, content, image etc.

Now the question is, would it be possible to automatically generate a given set of acf fields, then automatically populate them within the creation loop for the import file? If so, how would population be done, ie: with having repeater fields, images, text fields? etc - All while keeping relationship data between everything?

Having nearly 1M posts just doesn't allow for any type of "wp_insert_post" function within a loop...

Thoughts / Suggestions?

elliotcondon commented 5 years ago

Hi @prodjallen

Without knowing the exact details of your project, it is hard for me to give a solution, but I'm happy to help point you in the right direction.

I suggest spending some time in the wp_postmeta table understanding how ACF saves metadata for a given field. You can definitely perform a bulk insert using custom SQL.