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