Site logo

Archived topic

Need to remove header h1 tag from the html

3 replies · Started by Nathaniel on September 4, 2017

Viewing posts 1–4 of 4

Hello,
I have a home page that has a header using a page builder. This header has an <h1> tag in it. H1 tags are important for search engines to help them understand the main focus of the page. However, when I disabled the default theme header, it only hid the theme header in css. It didn't remove it from the html.

Is there any way to disable the header so that the default theme header elements are not even sent to the browser in the html?

If you need to look at my page, please go to https://www.myseostrategy.com and view the page source. Then do a search in the source for "h1" and you will see 2. One with the word "Home" and another with the words "My SEO Strategy".

Thank you,

Ok, but is it possible to do it for just one page? I only want this removed from pages where i click the "disable header" option. Is that possible without a whole ton of effort?

Yup for sure. Just the static home page?

Try this:

add_action( 'after_setup_theme','tu_remove_header' );
function tu_remove_header() {
    if ( is_front_page() ) {
        remove_action( 'generate_header','generate_construct_header' );
    }
}

Adding PHP: https://docs.generatepress.com/article/adding-php/

This archived topic is closed to new replies.