Support

Account

Home Forums Gutenberg ACF Block styles preview not working in WordPress 5.9

Solving

ACF Block styles preview not working in WordPress 5.9

  • Hello,

    I have some custom ACF block styles created. Their CSS are in the global style-editor.css file. The previews of the block styles worked perfectly before WordPress 5.9. But now it seems that those previews are displayed inside an iframe and cannot read the style-editor.css styles, so they appear unstyled. Is there any solution for this please?

    Thank you in advance

  • I have it. If the editor style css file is added using “add_editor_style” instead of using “enqueue_block_editor_assets” it works.

  • Just to mention – for variations with ACF Pro 6.0:

    add_action('init', function() {
        wp_register_style('awp-block-styles', get_template_directory_uri() . '/assets/css/custom-block-style.css', false);
        register_block_style('core/heading', [
            'name' => 'colored-bottom-border',
            'label' => __('Colored bottom border', 'txtdomain'),
            'style_handle' => 'awp-block-styles'
        ]);
    });
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.