MB Blocks 1.8.0 stops enqueueing assets on frontend
- This topic has 5 replies, 2 voices, and was last updated 1 week, 6 days ago by
Johannes Gross.
-
AuthorPosts
-
March 26, 2026 at 1:13 AM #49846
Johannes Gross
ParticipantHello,
After the recent MB Block 1.8.0 update, the CSS file enqueued through enqueue_assets is not anymore loaded on the frontend. Downgrading back to MB Block 1.7.6 fixes it. Can you take a look? Here is my markup:
$meta_boxes[] = array( 'id' => 'twt-modules', 'title' => 'TWT Modules', 'type' => 'block', 'icon' => 'editor-table', 'category' => 'layout', 'context' => 'normal', 'render_template' => get_stylesheet_directory() . '/blocks/twt-modules.php', 'enqueue_assets' => function() { wp_enqueue_style('twt-modules', get_stylesheet_directory_uri().'/blocks/twt-modules.css', array(), filemtime(get_stylesheet_directory()."/blocks/twt-modules.css")); }, 'supports' => array( 'anchor' => true, 'customClassName' => true ), 'fields' => array( array( 'name' => '', 'id' => 'modules', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'collapsible' => true, 'default_state' => 'collapsed', 'group_title' => '{label}', 'fields' => array( array( 'name' => 'Label', 'id' => 'label', 'type' => 'text', ), array( 'name' => 'URL', 'id' => 'url', 'type' => 'text', ), array( 'name' => 'Image', 'id' => 'img', 'type' => 'single_image', ) ) ) ) );March 26, 2026 at 9:49 PM #49852Peter
ModeratorHello Johannes,
Thank you for reaching out.
I notice that we can register the style file with relative path like this
'enqueue_style' => '/wp-content/themes/metabox-theme/blocks/hero-content/hero-style.css',instead of the absolute path
'enqueue_style' => get_stylesheet_directory() . '/blocks/hero-content/hero-style.css',can you please recheck this on your site?
March 26, 2026 at 10:28 PM #49854Johannes Gross
ParticipantGood idea! Unfortunately, switching it to the relative static path did not fix it for me either. I tried it both through 'enqueue_style' and 'enqueue_assets'.
April 23, 2026 at 10:46 PM #49926Johannes Gross
ParticipantAfter updating to 1.8.2, scripts and styles are now loading on all pages - regardless if the custom block is used or not. Before, it was only loading them if the block was used. Can you please look into this?
April 24, 2026 at 9:26 PM #49928Peter
ModeratorHello Johannes,
Can you please use the setting
enqueue_stylesetting instead of the settingenqueue_block_assetsand recheck the issue?April 27, 2026 at 9:41 PM #49932Johannes Gross
ParticipantThat fixed it. Thank you!
-
AuthorPosts
- You must be logged in to reply to this topic.