Home › Forums › Feature Requests › Set 'Post Title' from Field Group (Toggle) › Reply To: Set 'Post Title' from Field Group (Toggle)
I wasn’t setting the ID into the my_post array.
I’ve added that in and it works now for both new and updated posts. Weird how it updated for existing items but now new items.
if ( get_post_type( $post_id ) == 'equipment' ) {
$my_post = array();
$my_post['ID'] = $post_id;
$my_post['post_title'] = get_field( 'name', $post_id );
wp_update_post( $my_post );
}
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.