Home › Forums › ACF PRO › update_field date field not displaying date on the admin front-end › Reply To: update_field date field not displaying date on the admin front-end
Hmmm, I had tried it with quotes also. Either way, with or without the quotes, it reads the field OK and does the calculation as expected.
I also read somewhere (forgotten where, amongst all the Googling!) that with date types, the field key should be used instead of the field name.
Field name, field key, with and without quotes, the update field doesn’t seem to write data and the field remains blank.
I tried also adding $post_id too, although I believe this defaults to the current post anyway.
$reviewDate = get_field('document_review_date');
$remindDate = date("Ymd", strtotime($reviewDate . '-7 days'));
update_field('field_60f4466dcddc8', $remindDate, $post_id);
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!
The most recent ACF Chat Friday featured a live demo of how to register CPTs directly in the plugin, one of our most requested features. Check out the summary below for a replay of the demo, and don’t forget to register for the next session! https://t.co/k2KQ3WWBAz
— Advanced Custom Fields (@wp_acf) March 9, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.