Home › Forums › Front-end Issues › Custom Taxonomy With Text Input › Reply To: Custom Taxonomy With Text Input
I add bellow code to the theme function.php
$post = array(
'post_status' => 'publish',
'post_title' => $_POST["fields"]['field_52e6af7f6f4b8'] ,
'post_content' => $_POST["fields"]['field_52e6af906f4b9'],
'post_type' => 'post'
);
// insert the post
$post_id = wp_insert_post( $post );
update_field('field_52e6afd36f4bc', $_POST['field_52e6afd36f4bc'], $post_id);
// update $_POST['return']
$_POST['return'] = add_query_arg( array('post_id' => $post_id), $_POST['return'] );
// return the new ID
return $post_id;
}
where “field_52e6afd36f4bc” is the field key of custom taxonomy “rent”. I don’t understand what is update_field()’s $value for frontend new post, where user insert a value, not like the example- $value=”some string”.
And where I put update_field(), into function.php or templete.php.
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.