Home › Forums › Feature Requests › Inserting fields programatically › Reply To: Inserting fields programatically
Ah okay.
Well I don’t see what exactly you want.
The update_field
will work as long as there are actual fields to the content you want to add them to, they don’t need to already have content.
And to create fields completely from scratch you’d use the PHP functions already available like acf_add_local_field()
.
There’s no point in a insert_field()
function as it would either do the same as acf_add_local_field()
or just add meta to content. In the latter case it wouldn’t be helpful since there’s no actual ACF field to go with it.
There is however a plan to create a new api function for inserting new rows into a repeater or flexible field. That is currently a bit tricky (but doable) and it will be much easier!
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.