I am using the ee model class to save channel entries via AJAX.
Everything is working well except for custom fields, which don't save.
Here is the code:
$entry = ee('Model')->make('ChannelEntry'); $entry->title = $title; $entry->url_title = $url_title; $entry->site_id = ee()->config->item('site_id'); $entry->author_id = ee()->session->userdata('member_id'); $entry->ip_address = ee()->session->userdata['ip_address']; $entry->entry_date = ee()->localize->now; $entry->edit_date = ee()->localize->now; $entry->custom_field = $custom_field_value; $entry->channel_id = $channel_id; $entry->save();
Everything works except for the
custom_field part. It will create the new entry and save all of the correct data, but just not that.
Is there a step I'm missing?