Home › Forums › Front-end Issues › Front end form not uploading media / not loading wp-uploader
I’m trying to create a front end form for users to create a post in a custom post type (“books”). The basic form inputs work fine, but images aren’t uploading/the wp-loader popup doesn’t load. If I choose ‘basic’, the image doesn’t upload to media, and if I choose ‘wp’, the “add image” button on the front end doesn’t load anything. Am I missing something? I’m testing with Admin/full permissions.
<?php acf_form_head(); ?>
<?php acf_form(array(
'post_id' => 'new_post',
'field_groups' => array(27),
'post_title' => true,
'uploader' => 'wp',
'form' => true,
'new_post' => array(
'post_type' => 'books',
'post_status' => 'pending'
),
// 'return' => '%post_url%',
'submit_value' => 'Submit',
'updated_messag' => 'Submitted!'
)); ?>
<?php endwhile; ?>
Also, the “add row” for repeater fields doesn’t work, either. This makes me believe I’m missing something…
Thank you
I’m assuming I’m missing:
// Enqueue uploadedr scripts.
acf_enqueue_uploader();
and
// Trigger the append action and provide the newly appended jQuery element.
acf.do_action('append', $('#popup-id'));
but adding these doesn’t seem to do the trick. Maybe I’m adding them wrong?
Moving the get_header();
above acf_form_head();
worked, the images are now being uploaded and the ‘add row’ is now working, but I’m getting an error after submission:
Warning: Cannot modify header information – headers already sent by (output started at C:…wp-includes\class.wp-styles.php:214) in …\wp-includes\pluggable.php on line 1340
not sure what’s going on
I had some html in my header, so it was throwing that error due to it being before acf_form_head. Loading acf_form_head();
before that made the error stop
However I’m noticing that while the images are being uploaded to media, they still aren’t being added to the post
You must be logged in to reply to this topic.
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.