Support

Account

Home Forums Backend Issues (wp-admin) How to check a box when saving a post? Reply To: How to check a box when saving a post?

  • It it is a checkbox field then you need to update it with an array of the values you want checked, each value is not stored separately.

    
    $status_active = get_field('status_active', $post_id);
    if (!in_array('status_locked', $status_active)) {
      $status_active[] = 'status_locked';
      update_field('status_active', $status_active, $post_id);
    };