I'm trying to get a CCK text field's value using node_load() - the code goes like $nodeObject->field_name['und']['0']['value'];

Is there a simpler built-in function like get_cck_field_value(node $nodeObject) that I can use, or do I write it myself?

  • I think there is nothing so. Please share if you make one.
    – niksmac
    Commented Apr 11, 2012 at 11:30

2 Answers 2


You can use field_get_items() like this:

field_get_items('node', $node, $field_name);

Also see What's best practice when working with the language['und']?.

  • 1
    Thank you for the link you provided field_get_items() is great, and so is entity_metadata_wrapper()... does any of them include an additional call to the DB? I shouldn't think so, but still...
    – Aditya M P
    Commented Apr 11, 2012 at 12:31
  • @harijari Nice finding
    – niksmac
    Commented Apr 13, 2012 at 4:46

You can also use methods provided by Entity API module:

$node = node_load($nid);
$wrapper = entity_metadata_wrapper('node', $node);
$field_value = $wrapper->field_name->value();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.