Skip to content

Block Style Variations CSS not loaded for non-admins #64755

@kraftner

Description

@kraftner

Description

The styles for block style variations are not visible in the editor for anyone without the edit_theme_options capability, so anyone but administrators.

They are loaded in the frontend but not in the backend.

Looking at the browser console one can see errors wit the REST API, but only in WP 6.6.1 without Gutenberg. With Gutenberg I don't see those errors, but the behavior and display of the blocks in the editor still has the same bug.

Step-by-step reproduction instructions

  1. Create a user with any role that doesn't have edit_theme_options , e.g. editor.
  2. Open a post and insert a button with a block style variation, e.g. core/button.
  3. Apply a block style variation. You will not see the corresponding styles.
  4. Save and open the post in the frontend and see the style.

Screenshots, screen recording, code snippet

Screenshot showing 2 button blocks in the backend, looking the same although one has the outline style applied

Screenshot showing the same post in the frontend where everything is right

Bildschirmaufzeichnung.vom.2024-08-23.17.49.21.webm

REST API errors in WP 6.6.1 without Gutenberg

Bildschirmfoto vom 2024-08-23 18-13-51

Environment info

  • WordPress 6.6.1
  • with and without Gutenberg 19.0.0
  • Twenty Twenty-Four theme

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Feature] Block Style VariationsIssues or PRs that are related to the style variations for blocks[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions