Programmatically loading Custom block in page/node preprocessor I've followed some previous solutions on DA to programmatically load a Custom block in my page preprocessor hook but nothing I try seems to be working.

Currently, my custom block is within Structure > Block Layout > Custom block Library under the name 'SGT Pricing Header' (Machine name: sgt_pricing_header, ID 12).

I have attempted loading it in the page preprocessor as well as the node preprocessor hooks. 

Currently I have:

function THEME_preprocess_node(&amp;$variables) {
    $block_entity = Drupal\block_content\Entity\BlockContent::load(12);// BLOCK_ID
    $block_view = \Drupal::entityTypeManager()-&gt;getViewBuilder('block_content')-&gt;view($block_entity, 'sgt_pricing_header');
    $variables['block_pricing_header'] = $block_view;
}


I have also used 'sgt_pricing_header' in place of the ID 2 with no success.

In the TWIG template, which is a paragraph template by the way, if that is relevant, I am simply trying to display the block with 

{{ block_pricing_header }}


I referenced Programatically render a block in a twig template when trying to get this to work.

I also tried using Twig Tweak to display the block, without success.

{{ drupal_block('sgt_pricing_header') }}


Simply does nothing.

PHP Version: 5.6.32-1+ubuntu17.10.1+deb.sury.org+1
Drupal version: Lightning (lightning-8.x-2.17) 

Not entirely certain what to try next other than simply hard code the block content into the template which I would prefer to avoid.
I think the problem here is that Drupal 8 has both block definitions (a.k.a. plugins) and block instances.  Both of which tend to be called blocks.  What is listed in the custom block library is a block definition. This is like what is done when a block is created with code.  It define the block but not the configuration.

An instance is the configuration data for a block.  It has the settings for a specific block.  E.g., title override, display title, region, and the like.

So, you are trying to render the block definition with code that requires an instance block.

How do you get an instance of a block to render?  The simplest way is to create a hidden region in your theme by adding a region line in the info file.  Something like "Hidden Blocks".

Add your custom (or code based) blocks to this region in the block placement screen.  I also tend to set the rules for where this can be displayed just to help keep these from being generated when not needed.

Once you do this, you should be able to render using the block id from the placement screen.  Note this can be different from the plug-in id on the custom block page if you have placed it more than one.