Disable block caching I just made a simlple block by using block > custom block, so I didn't make it programmatically.

I am a Drupal 8 newbie, and I look for a simple and clear solution how to disable caching for that block.

What code should I use ? In what file to put the code ? How to target that unique block ?

Thanks !
if you have a custom module let's suppose it called custom_module, your custom_module.module implement hook_preprocess_HOOK.

/**
 * Implements hook_preprocess_HOOK() for block.html.twig.
 */
function custom_module_preprocess_block(&amp;$vars) {
  //- Change the block-id-name by your block id
  if($vars['derivative_plugin_id'] == 'block-id-name') {
    //- This stops the block being cache in drupal 8
    $vars['#cache']['max-age'] = 0;

  }


Edit :
if you don't know the exact block id you can install Block Content Machine Name module, it will give you the possibility to give a machine name to your custom block, and then implement the hook like the following:

/**
 * Implements hook_preprocess_HOOK() for block.html.twig.
 */
function custom_module_preprocess_block(&amp;$vars) {
  //- Change the block-machine-name by your block machine name
  if (isset($vars['elements']['content']['#block_content']) &amp;&amp;
    $vars['elements']['content']['#block_content']-&gt;get('machine_name')-&gt;value == 'block-machine-name'
  ) {
    $vars['#cache']['max-age'] = 0;
  }
}