I have a content type that has a unique field. How can I load a specific node based on this? node_load() only takes the nid. I am using Drupal 7.


There is indeed an API function: EntityFieldQuery, which has lots of example use cases scattered around this site.


Run a query against the database to find the node that has the field with the specified value and return the nid. Then run the nid through node_load()

  • Thanks, was just wondering if there was an API for that.
    – Kevin
    Jul 14 '11 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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