Support

Account

Home Forums Backend Issues (wp-admin) update_field working in DB but not visible in wp-admin

Solved

update_field working in DB but not visible in wp-admin

  • Hi!

    Im working on a site connected with stripe. When a payment goes thru, a ACF field will update with a date 1 year from when the payment got thru.

    The function works, since the value is saved in the DB. But when I view users in the dashboard on wp-admin the value is blank. When I call get_field() on the front it renders alright. What is that all about? Cant get my head around it.

    //Set end date for access
     $date_now = date('Y-m-d');
     $exp_date = date('Y-m-d', strtotime($date_now . " + 365 days"));
                
     // update field
     update_field('field_612e85072c441', $exp_date, $user);

    I gave it a go to write 'user_'.$user_id aswell, but that made it worse. Do I need to save the field somehow? See the prints attatched here. The one on the frontend has added 1 year, but the one in wp-admin is still the same.

    Thanks!

  • Nevermind… it is resolved!

  • What was the problem? The date format needed to be Ymd?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.