Home › Forums › General Issues › Using acf_form – add post title… › Reply To: Using acf_form – add post title…
you need to remove this code:
'html_before_fields' => '<input type="text" name="post_title" size="30" id="title" placeholder="Enter title here" autocomplete="off">',
you need to create a text custom field that you will assign to be your title. The code below assigns the custom field to be the post title:
$post = array(
'ID' => $post_id,
'post_type' => 'events',
'post_title' => $fields['new_title']['value'],
'post_status' => 'draft'
);
please also include this code inside the function before the // Continue save action
. I completely forgot about it:
// Update the Post
wp_update_post( $post );
edited my post above as well and added this code.
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.