My acf_form is on a page. By adding a variable I ‘feed’ the proper post ID into the form. Like so: http://dvp.dev/edit-advertentie/?id=492
And yes it’s on there 🙂
I use twig so I can’t place php in files, so I created a shortcode which echoes the acf_form and takes the posted variabale into account as the post_id.
This is the shortcode code: http://pastebin.com/dDANWavf
This is the code I use to display the form: http://pastebin.com/rFL7mEWF.
As I said it’s Twig, but basically on line 18 it checks if the user has an id.
If so, he’s logged in. If no id = provided in the url then no post ID is passed to the form. If an id is passed (like in the URL above), then that post values are loaded into the form. Works on all fields, except the images.
I’ll send the JSON export in a private post after this.
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!