1

I have been looking for a solution for sometime now. Have not found any one yet... All we all know every page should have only one H1 tag, however it is not known for most of the non tech editor. I want to restrict the heading option. So there will be no confusion. Better yet, if we can change the label to L, M, S for H2 H3 H4. It will make more sense. one article should not have more than 2 sizes of heading in fact.

Thanks

1
  • 1
    1 H1 per page is not true, tags such as <section> <aside> <article> or <nav> have internal heading hierarchies as of HTML 5, and some blocks use those tags ( I hope your theme does too ). What you're asking is going to be very difficult to do, if it's possible at all, without building new replacement blocks. If you did do this, it would be immediately obvious in the outliner and document map at the top too. You also have the problem of confusion as text size is already an option in the block inspector sidebar
    – Tom J Nowell
    Feb 15, 2021 at 15:48

1 Answer 1

0

Before WP 5.9 it was possible to get rid of some heading types with CSS like this:

.block-library-heading-level-toolbar .components-toolbar-group {
    button:nth-child(1), button:nth-child(5), button:nth-child(6) {
        display: none;
    }
}

Since WP 5.9 the HTML code has changed. Now you can hide H1, H5 and H6 like this:

[aria-label="Heading 1"], [aria-label="Heading 5"], [aria-label="Heading 6"] {
    display: none;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.