• Resolved kcaluwae

    (@kcaluwae)


    I’ve edited a block as HTML (in this particular case a table) to add some css selectors to the elements.

    If I then try to go back (edit visually) WordPress says the block is broken and when recovering the block it removes the css selectors.

    Is this the expected behaviour? I’ve tried running the code, it’s perfectly fine.

    Will I need to keep the block as HTML or is there another solution?

    PS: I know I can add classes in WordPress itself but in this case, for a table, I need to add things on thead and td level as well which I don’t think is possible without diving in the HTML itself.

    • This topic was modified 2 years, 10 months ago by kcaluwae.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Sorry for the slow reply. Perhaps you’ve found a solution yourself by now.

    WP is very finicky about what sort of HTML it’ll allow. When you deviate, even though with valid HTML, it thinks the block is broken. I think if you ignore the suggestion to recover and leave things be your added classes will remain.

    Not ideal to have perpetual error messages in your content that you need to ignore. The alternative is to alter what HTML WP allows through the ‘wp_kses_allowed_html’ filter hook.

    Thread Starter kcaluwae

    (@kcaluwae)

    Thanks @bcworkz . Good to know.
    I will just start using custom HTML blocks in that case.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Editing table blocks as HTML’ is closed to new replies.