How to programmatically save a value in a long text with summary field? I have a content type which has a field of type "long text with summary".

When I to try programmatically save a node with the code below, the value is not being saved. 

How can I save the data into the field and set the format to "full_html"?

what does not work (assume the rest of the fields are set):

$node = new stdClass();
$node-&gt;type ='some_type';
$node-&gt;language = 'en';
node_object_prepare($node);
$node-&gt;field_custom_description_value = 'some_value';
$node-&gt;field_custom_description_format = 'full_html';

/* I also tried this */
$node-&gt;field_custom_description[$node-&gt;language][0]['value']-&gt; 'some_value';
$node-&gt;field_custom_description[$node-&gt;language][0][format]-&gt; 'full_html';
You forget the # in the #format, use this:

$form['field_name'][LANGUAGE_NONE][0]['#format'] = 'full_html';
$form['field_name'][LANGUAGE_NONE][0]['#format'] = 'filtered_html';


Read this: How to set the default format per content type at Drupal 7?