I have a custom block created in code. I do not want to cache the block. I know I need to use BLOCK_NO_CACHE but I am not sure where to use it.

function mymod_block($op = 'list', $delta = 0)
    // set up an empty array which will contain the block contents
    $block = array();
    if ($op == "list") {
        // Generate listing of blocks from this module, for the admin/block page
        $block[0]["info"] = t('mymod');
    else if ($op == 'view') {        
        $block['content'] = "hello world";
    // return the built content
    return $block;

1 Answer 1


In your list $op, add:

$block[0]['cache'] = BLOCK_NO_CACHE;

However, note that Drupal 6 will not automatically update your block information, you will have to do that yourself, see privatemsg_update_6002() for an example.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.