
Overview.
For same reasons, after make update the Drupal core from 8.4.x to 8.5.x version, some of custom blocks will be disapeared for anonymous users.
The cause of problem is, block status field has been set to NULL in database and there is no option to change it in block edit/settings page.
Solutions.
You can follow the step below to resolve the issue. There is no PHP error and no prolem with the user permissions.
- Install module Devel
- Go to http://yoursite/devel/php
Enter PHP code below and execute it.
$query = \Drupal::entityQuery('block_content'); //Select blocks with status field is NULL $query->notExists('status'); $block_ids = $query->execute(); foreach($block_ids as $block_id){ $block = \Drupal\block_content\Entity\BlockContent::load($block_id); //Update block status $block->set('status', 1)->save(); };
- Flush Drupal Cache.
- Done