Here is the code to update field value by content type Drupal
$query = \Drupal::entityQuery('node')->condition('type', ' dealer_locator')->execute(); $nodes = \Drupal\node\Entity\Node::loadMultiple($query); foreach ($nodes as $node) { $node = \Drupal\node\Entity\Node::load($node->nid->valued); $field_status=1; $node->set('field_status', $field_status); $node->save(); }