Programmatically-delete-custom-content-block-drupal-10-deploy-hook
- delete content block in deploy hook
- drupal 10 delete content block
- drupal 10 delete “custom block” programmatically
Getting the namespace via Drupal’s API documentation: https://api.drupal.org/api/drupal/core!modules!block_content!src!Entity!BlockContent.php/class/BlockContent/
/**
* Remove unused content block.
*/
function mass_deploy_delete_old_footer_content_block() {
$block = \Drupal\block_content\Entity\BlockContent::load(2);
$block->delete();
}