Home › Forums › General Issues › Frontend Form not populating right in backend › Reply To: Frontend Form not populating right in backend
I think I gave you the wrong code. I’m sorry about that. Please try this one instead:
// create the update data holder
$vbs_post = array();
$vbs_post['ID'] = $post_id;
$vbs_post['post_title'] = $new_title;
If you want to change the post slug, please try this code:
$vbs_post['post_name'] = 'this-is-the-new-slug';
Please check this page for more parameters: https://developer.wordpress.org/reference/functions/wp_insert_post/.
Also, please don’t forget to save the changes like this:
//Unhook function to prevent infitnite looping
remove_action('acf/save_post', 'vbs_post_title_updater', 20);
// Update the post into the database
wp_update_post( $vbs_post );
//Rehook function to prevent infitnite looping
add_filter('acf/save_post', 'vbs_post_title_updater', 20);
Hope this helps 🙂
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.