Currently, the GeneratePress theme (affiliate link) has H2 (<h2>) heading tags set for the sidebar widget titles.


That’s not the best on-page SEO practice.

After the H1 heading tag, H2s are the most important for your posts and pages.


They are used to structure your main content and, whenever possible and relevant, they should contain keywords.

Mixing sidebar titles like “Recent Comments” or “Recent Posts” with your main content’s subheadings is not peachy.

Therefore, in this guide, I’ll show you how to change the sidebar heading tags in the GeneratePress theme.


Change sidebar heading tags in GeneratePress

I recommend backing up the file or the website and also have a child theme in place. Here’s where you can download the GeneratePress child theme. A child theme alternative is the Code Snippets plugin.

Step 1

You’ll need to access your theme’s files and edit the functions.php file.

The functions.php file should usually be in:



If you’re doing this for your add-on domain, not your main one, then the file should usually be in:


generatepress functions.php edit
Editing the GeneratePress functions.php file in cPanel

Step 2

Add the below code right at the bottom of the file or right before the ?> ending tag (in case there’s one).

Copy to Clipboard

This will change the sidebar heading tags in GeneratePress to H4 (<h4>).

H3 (<h3>) heading tags are still needed quite often as sub-subheadings in the main content, so it’s best if you don’t add them as widget titles in sidebars and footers.

How to check if the sidebar heading tags were changed

To check if the heading tags have been replaced, right-click exactly on one of the widget titles and select Inspect or Inspect Element (depends on the browser).

A window will appear at the bottom of the screen with the source code for the selected element, and the widget title should be the one highlighted if you right-clicked exactly on it.

generatepress sidebar h4 heading tags

As you can see, my Recent Posts widget title uses an <h4> heading tag now.

If the changes don’t take place, clear your site and browser caches.

That’s a wrap

Hope you found the post useful and you managed to change the sidebar heading tags in your GeneratePress theme!

Don’t forget to share the post to help out others!

You can quickly subscribe to my newsletter by using this link.

If you have any questions or thoughts, drop a comment or send a message via contact or Facebook page.

You can also hit the follow button on Twitter and subscribe to the YouTube channel.

My WordPress installation service is at your disposal!

On-going WordPress support and maintenance services are on the menu as well!