You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is currently possible with the classic editor through the tiny_mce_before_init filter.
I know a decision was made to deemphasize H1 which was great. However it would be even better if there was a way to remove it entirely for businesses, agencies, universities, etc that use H1 in the actual template so that admins can't accidentally (or purposefully) mess up seo for the larger organization like ours.
Anywhere that this could be added would be great. Maybe a filter similar to tiny_mce_before_init.
Thanks
Reacted by ChemicalSailor, Romain Menke, Richard WO, Rafał Grzejszczyk, Diego Oliveira, jake whiteley, Sjoerd Boerrigter, Sauli Rajala, wwdes, Dominique Pijnenburg and 17 more
Please not only h1, but any heading. For many cases it doesn't make sense allowing six levels of headings.
Also, I really like the google docs UI, where you can only select an h3, for example, if an h2 was used previously. Prevents many errors, where editors are just using a headline level because it looks the way they need it.
Reacted by atstormcup, Romain Menke, Hawken Rives, Richard WO, Rafał Grzejszczyk, jake whiteley, z0mbat, Andrew, Xavi Benjamin, Sjoerd Boerrigter and 17 more
A lot of agencies use WordPress for client websites, and it is likely the case that most templates already have a H1, or as @gustavpursche pointed out, the theme we provide them does not have styling for a H6 for example.
We need a way to restrict what clients can add - for their own good!
Also in need for this. Most times we add the title of the page/post in an H1 in the template files. Clients shouldn't use it, so it'd be best if it wasn't available at all for them.
99% of sites use h1 for page title for most content. In these situations content editors should not be able to add h1 titles.
What we need is to be able to disable any of the h1-h6 for any specific post type.
I haven't done extensive testing yet so YMMV. Works locally 😉
If you really wanted to, you could also hide the heading-level buttons in the admin with CSS by targeting the aria-label attribute (see https://davidwalsh.name/add-custom-css-wordpress-admin for how to add a custom admin stylesheet):
Just note that this will break if the label text changes, and could have unforeseen consequences so please test first. I only tested it using the browser dev tools.
We also regularly need granular control of which headings are required. The title of our pages tend to be an h1 of the page title, and the following headings need to sit beneath this. We would like to at least remove h1s, and also the option of removing one or more of the h4-h6 elements which rarely have visuals supplied by the designers.
We'd like the flexibility to control this at theme level.
Disclaimer: I have no idea how this all actually works, I'm just trying to be useful. Also I've never used useSetting or theme.json, but have been crawling the docs for examples and cobbled this together.
Reacted by Ted Whitehead, Dominique Pijnenburg, Dave, Joshua Dorenkamp, beyondtheline, lbuffet-pro, Kerri McHale, Frumillon Pierre and Triner Media + Print
defining levels in theme.json would be ideal, err, the best we can do in this environment
Reacted by Julie Moynat - Pro, lbuffet-pro, Kerri McHale, Frumillon Pierre, Joshua Dorenkamp, Dominique Pijnenburg, Triner Media + Print, Christopher Hill, James Macon and c-pechlevanoudis-btw
The heading block is not the only block that has a heading level option.
I think before we can add this option to theme.json, we need to unify the heading level controls: #46003
One can use the new component in a custom block and decide the levels.
As far as I know, there is no way to filter the defaults. It has not been implemented.
Activity
swissspidy commentedon Apr 24, 2019
Previously: #13565
myleshyson commentedon Apr 24, 2019
Yea but this is a different matter. Our organization actually just wants a way to completely remove it. #13565 wanted to add it to the title bar.
gu-stav commentedon Sep 17, 2019
Please not only h1, but any heading. For many cases it doesn't make sense allowing six levels of headings.
Also, I really like the google docs UI, where you can only select an h3, for example, if an h2 was used previously. Prevents many errors, where editors are just using a headline level because it looks the way they need it.
jakewhiteley commentedon Aug 18, 2020
I also need this.
A lot of agencies use WordPress for client websites, and it is likely the case that most templates already have a H1, or as @gustavpursche pointed out, the theme we provide them does not have styling for a H6 for example.
We need a way to restrict what clients can add - for their own good!
warudin commentedon Jan 11, 2021
Also in need for this. Most times we add the title of the page/post in an H1 in the template files. Clients shouldn't use it, so it'd be best if it wasn't available at all for them.
wwdes commentedon Feb 9, 2021
+1
99% of sites use h1 for page title for most content. In these situations content editors should not be able to add h1 titles.
What we need is to be able to disable any of the h1-h6 for any specific post type.
dtipson commentedon Feb 11, 2021
This is also an accessibility concern. Users being able to add h1s breaks the proper document outline.
kloh-fr commentedon Feb 16, 2021
+1 for this request.
For now the best move I've found is this one: https://github.com/yannkozon/mu-plugins/blob/master/remove-h1-wp-editor.php
tedw commentedon Aug 30, 2021
For anyone interested, here’s one way to convert H1 to H2:
I haven't done extensive testing yet so YMMV. Works locally 😉
If you really wanted to, you could also hide the heading-level buttons in the admin with CSS by targeting the
aria-labelattribute (see https://davidwalsh.name/add-custom-css-wordpress-admin for how to add a custom admin stylesheet):Just note that this will break if the label text changes, and could have unforeseen consequences so please test first. I only tested it using the browser dev tools.
filipecsweb commentedon Oct 6, 2021
+1
tsdexter commentedon Dec 3, 2021
I am using this code to force
H1back toH2but +1 for giving us a filter to override toolbar buttons and inspector controls on other blocksI've also added this to the editor CSS to hide the button:
djave-co commentedon Mar 22, 2022
We also regularly need granular control of which headings are required. The title of our pages tend to be an h1 of the page title, and the following headings need to sit beneath this. We would like to at least remove h1s, and also the option of removing one or more of the h4-h6 elements which rarely have visuals supplied by the designers.
We'd like the flexibility to control this at theme level.
With this in mind, we have the following line in https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/heading/heading-level-dropdown.js
Would it be possible to add something to theme.json that would allow these values to be edited:
And then we could replace the
HEADING_LEVELSwith something more like this:Disclaimer: I have no idea how this all actually works, I'm just trying to be useful. Also I've never used
useSettingortheme.json, but have been crawling the docs for examples and cobbled this together.JoshuaDoshua commentedon Apr 9, 2022
defining levels in
theme.jsonwould be ideal, err, the best we can do in this environmenthannahmumma commentedon Aug 13, 2022
Is this happening. I need it
mkismy commentedon Dec 27, 2022
+1
carolinan commentedon Jan 4, 2023
The heading block is not the only block that has a heading level option.
I think before we can add this option to theme.json, we need to unify the heading level controls: #46003
jordesign commentedon Aug 4, 2023
To my reading - #46003 should mean that it's possible to remove H1 from the list in theme.json - is that correct @carolinan ?
carolinan commentedon Aug 4, 2023
No, that has not been implemented.
One can use the new component in a custom block and decide the levels.
As far as I know, there is no way to filter the defaults. It has not been implemented.
jordesign commentedon Aug 4, 2023
Thanks for the clarification @carolinan - I'll leave this issue open 👍
jordesign commentedon Aug 25, 2023
Closing this issue as a dupe of #20213 - where there is more recent discussion (and a broader use-case)
ndiego commentedon Aug 28, 2024
I just wanted to note that disabling H1 from the UI is now possible: #63535
tedw commentedon Aug 28, 2024
@ndiego Thanks so much for this! Love the solution 👍