How to Remove H1 Headings from the WordPress Editor Dropdown

Posted on Updated on

The WordPress editor allows us to create sophisticated blog posts with no knowledge of HTML. The GUI toolbox uses a framework called “TinyMCE” which provides the formatting buttons, icons, and other GUI elements you see above your WordPress editing page. It automatically inserts the required HTML into the backend so that you don’t have to.

TinyMCE can also be customized to add or remove items from the UI. There’s no inbuilt way to change the settings via the default WordPress options, but the underlying code provides the usual hooks and filters that allow modification and which make WordPress one of the most flexible content creation platforms that exist. I’d written earlier for example how to include a table button in TinyMCE and while that was quite complicated, the reverse can be much easier. Removing an element like H1 is easy.

Why Remove the H1 Option in the TinyMCE Dropdown?

HTML allows you to structure the contents of your page using convenient headings and sub headings. These start with H1 and go all the way down to H6, with lower numbers typically having larger fonts and styles. As such, H1 is the biggest of them all, followed by H2 and so on. TinyMCE allows you to choose the style of the text from a familiar drop down box like this:

This allows a newbie with no prior knowledge of HTML to create headings and structure their content appropriately. However, it turns out that the “H1” or “Heading 1” option in the dropdown list is mostly useless and can actually harm your webpage. But why?

While you may think that the first heading in your content is the most important and therefore deserves the H1 tag, it would be a mistake. That distinction goes to the title of the page itself! And convention dictates that anything under an “H1” tag should be a subheading. So placing an H1 heading in your content doesn’t make sense because everything you write is “under” the title which is itself H1.

Moreover, search engines treat H1 headings with a lot more importance than they do sub headings. And when you’re writing an article, which piece of content is the single most important piece? The title! So having the title in H1 makes perfect sense. Most people click through an article just by reading the title, so you want the search engine to place as much focus as possible on your title. But if you use an H1 heading inside your content, you dilute that focus and take importance away from the title. This will certainly have a negative impact on your SEO.

For these two reasons, having an “H1” heading in the dropdown list is a bad idea, and can downright hurt your site.

Removing the H1 Option Entirely

Sure, you can always tell your writers not to use H1, but they can easily forget this advice or select it accidentally. It’s far more useful to remove the option entirely. This way, they can’t use it even by mistake. To achieve this, paste the following code into your functions.php or your plugin that holds custom PHP code:

function remove_h1_from_heading($args) {
	// Just omit h1 from the list
	$args['block_formats'] = 'Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Pre=pre';
	return $args;
add_filter('tiny_mce_before_init', 'remove_h1_from_heading' );

If you don’t know how to insert code like this into WordPress, read my earlier tutorial on the same. The final result will look like this in your WordPress editor:

Remove H1 Headings

As you can see, the “Heading 1” option that was there in the first screenshot is now missing entirely. This is exactly what we want, and it’ll remove the dangerous H1 heading option in your content that can hurt your site SEO.

2 Comments on “How to Remove H1 Headings from the WordPress Editor Dropdown”!

Leave a Reply

Your email address will not be published. Required fields are marked *