Home › Forums › Backend Issues (wp-admin) › Calculate PHP date_diff and save to ACF Field during post creation › Reply To: Calculate PHP date_diff and save to ACF Field during post creation
In theory, you should be able to add it below:
$post_id = wp_insert_post($new_post);
Reason being, you’ve accessed the order info, you’ve created the post and have the ID.
The only part you need to check is that date formats are correct and you change the custom_field name to your field.
Code is untested, so you may need to check, test and debug by echoing out various points to see if it works
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!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN— Advanced Custom Fields (@wp_acf) March 2, 2023
© 2023 Advanced Custom Fields.