Following the instructions from http://www.advancedcustomfields.com/resources/filters/acf-pre_save_post/ to create a new form to submit images for a custom post type via front-end.
Initial setup works well but a few strange behaviors I’m noticing:
Once I can confirm that the single photo process works smoothly I’ll be purchasing the add-on to do the multi-image uploads as that is the real goal for front-end submission for photos.
Thanks for the questions.
1. Can you clarify what you mean by this? Is the location rule not saving? If so, what is the location rule? You say
my submissions go to the wrong location, please note that it is up to your code to insert the new post to the correct post_type.
2. This is most likely the first value saved. What code are you using for the
3. This may be a JS bug when in the front end form. Perhaps you can provide a link for me to take a look and test?
1) When I go to the Custom Fields edit screen and change the location rule my group applies to CPT (gallery) it will save to that type. All subsequent form entries go to the CPT. But when I go back to the custom field edit screen, the drop-down displays as default post. Essentially every time I go back to the form I have to manually change the location back to CPT option.
2) With acf_form_head(); above get_header() call in a child theme of http://320press.com/wpbs/ in a very vanilla page template I have the following:
<?php $args = array( 'post_id' => 'new', 'field_groups' => array( 252 ) ); acf_form( $args ); ?>
3) Unfortunately it’s all in local dev atm. But followed very closely to the instructions from http://www.advancedcustomfields.com/resources/tutorials/using-acf_form-to-create-a-new-post/ for it. Dev environment is a vagrant VM and Capistrano/Composer stack based on Roots.io bedrock mostly.
#2 has been resolved thanks to this thread – http://support.advancedcustomfields.com/forums/topic/front-end-form-values-staying-filled/ – about pre-populated values with _new in the options table.
Issue: Field Group location rule is being stored to database but is NOT being shown as selected when viewing the Field Group.
Steps to reproduce:
1) Go to Custom Fields menu
2) Select Add New Field Group from top of page. Title: Gallery Details
3) Create fields (XML at bottom of this post)
4) Select Location Rule = Show this field group if Post Type is equal to gallery.
5) Publish Field Group.
6) Go to Gallery Post Type edit screen and the ACF form is there.
7) Go back to Field Group and Edit Gallery Details.
8) The Location Rule defaults back to Post Type = post.
9) If I update anything in the field group and do not also re-change the location rule back to Post Type = gallery, the ACF form will be moved from gallery CPT to post.
I *believe* the issue is related to my initial choice to use _ in my field names (gallery_photo, gallery_event, gallery_photographer) causing the location group to return to default.
The topic ‘Front-End Form default image and loss of post type’ is closed to new replies.
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!