7.x block.module block_custom_block_get($bid)

Returns information from database about a user-created (custom) block.


$bid: ID of the block to get information for.

Return value

Associative array of information stored in the database for this block. Array keys:

  • bid: Block ID.
  • info: Block description.
  • body: Block contents.
  • format: Filter ID of the filter format for the body.
2 calls to block_custom_block_get()
block_block_configure in modules/block/block.module
Implements hook_block_configure().
block_custom_block_delete in modules/block/block.admin.inc
Form constructor for the custom block deletion form.


modules/block/block.module, line 504
Controls the visual building blocks a page is constructed with.


function block_custom_block_get($bid) {
  return db_query("SELECT * FROM {block_custom} WHERE bid = :bid", array(
    ':bid' => $bid,


daveX99’s picture

FYI: I ran into some confusion when trying to access a custom block programmatically.

Using block_load returns a different object than does block_custom_block_get.

Specifically, block_load returns an object with a 'bid' element, but that is not the usual block ID that you see in raw HTML or in the path used to configure the block. The 'traditional' block id is in an element called 'delta' in the object returned by block_load.

Also, block_load does not provide the body of the block, only information about the block (status, weight, region, title, etc.). I needed to use block_custom_block_get to access the body of the block.

Benone_’s picture

I had same issue in hook_preprocess_block(&$vars).
the simplest solution for me was:

$bid = $vars['block_html_id'];
$bid = explode('-', $bid);
$bid = end($bid);