In my previous Headless Drupal post, I proposed ways to work with Drupal content programmatically, particularly for bulk tasks like updating many nodes.

But, in that post, I conveniently only covered plain vanilla Drupal nodes; what if the nodes you need to work with have CCK (Content Construction Kit module) defined fields? These are specified through Drupal’s administrative GUI, and so, its not obvious how to programmatically reference them.

This post will show you the way that I commonly deal with this situation, and I’m embarassed to say, it relies more on knowing a few Drupal tricks than any deep knowledge of the inner workings of Drupal. But these methods easily and reliably show you how to programmatically reference, access and change CCK defined fields just like any other node attribute.