Disable blocks for certain pages
If you want to change the visibility of many blocks at the same time, this module would be perfect:

https://www.drupal.org/project/block_visibility_groups


  Block Visibility Groups allows the site administrator to easily manage
  complex visibility settings that apply to any block placed in a
  visibility group. The visibility settings for all blocks in the group
  can be edited on one administration form.
  
  This modules works in conjunction with the Drupal 8 core's block
  administration system. It is a simpler alternative to modules like
  Panels.


Even you want to code this yourself, you can use this module as a starting point. The author of this module has a 2 hour video how this code was built.