Is it possible to add entries into categories when creating them with the Channel Entries API cant see anything in the documentation.
1 Answer
Within the channel entry API, you can pass the data array containing the array of category ids like:
ee()->load->library('api');
ee()->api->instantiate('channel_entries');
ee()->api->instantiate('channel_fields');
$data = array(
'title' => 'ENTRY TITLE',
'entry_date' => time(),
'channel_id' => x,
'category' => array($category_id)
);
ee()->api_channel_fields->setup_entry_settings($channel_id, $data);
ee()->api_channel_entries->submit_new_entry($channel_id, $data);