I am currently trying to create a new post of the type books. The form shows on the frontend with all the correct fields. The issue is that when I update / add the new post it does not save the title. I found the code below on this page – https://www.advancedcustomfields.com/resources/using-acf_form-to-create-a-new-post/.
I have also looked through other articles showing different ways to do this. According to the ACF documentation this should work, however I have had not luck yet.
Has anyone else run into this issue and know how to solve it.
Frontend Form Code
$args = array(
'post_id' => 'new_post',
'post_title' => true,
'new_post' => array(
'post_type' => 'books',
'post_status' => 'publish',
)
);
acf_form( $args );
Hi MWalcott,
Have you updated to 5.4.2? There was a bug on the previous version that was preventing the title from saving.
Regards,
Tiarnan
I’m running v5.4.4 and still experiencing this.
Is it documented somewhere where exactly the 5.4.2 issue/ fix was so I can check it on my install?
I just tested this on WP 4.6 and ACF 5.4.4 and it’s working as expected. I don’t know if there was a bug in the version you were using, but there is nothing mentioned in the readme that a bug related to this has been fixed.
Do you have acf_form_head();
in the template/theme before get_header();
If that’s not it then try deactivating plugins and maybe switching themes to figure out if there is some kind of a conflict.
acf_form_head()
helps with the actual saving of the form. For me the issue is that the post_title input field is displayed on the page without a name
attribute set, so the data isn’t submitted with the form.
I did some more digging and for me, it’s an issue that appears strictly when the form is loaded via AJAX, so I’ve made a separate forum topic documenting it more fully, found here.