Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Modified from A simple helper function to disable blocks programatically. Useful for deployment modules.
* Helper Function to disable blocks
* Modified from
* @param string $theme The name of the theme you'd like the block to be disabled on
* @param array $blocks Array of blocks. Module => Block name
function disable_block($theme, $blocks) {
foreach ($blocks as $module => $delta) {
$num_updated = db_update('block') // Table name no longer needs {}
'region' => '-1',
->condition('module', $module, '=')
->condition('delta', $delta, '=')
->condition('theme', $theme, '=')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment