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!
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.