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