How to use image field in a condition of an entity query?

To get X nodes which have no image as value of field_image I've tried this:

$nids = \Drupal::entityQuery('node')
->condition('field_image',NULL , '=')

it doesn't work I got always empty result.

1 Answer 1


You could try: $query->notExists('field_image');


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.