Resolved

How to remove an h2 tag that is not suitable for SEO from my website

Ultra Theme started by Rafael Apr 25, 2020 1 reply
Rafael Apr 25, 2020 · 10:01 pm #14292

Cheers,
I have installed the ultra-pro theme on several of my websites and I note that there are two h2 tags that cannot be controlled and that do not refer to any part of the content on the web.
Would you be so kind as to let me know how I can remove h2 from this content that is not relevant to web SEO?
This is the list of labels that appears in one of the entries:

<H1> Quartz
<H2> Post navigation <——————————–
<H3> Quartz
<H2> Post navigation <——————————–
<H3> Rafa Monllor
<H3> You may also like
<H3> Aragonite
<H3> Citron Quartz
<H3> Tectosilicates
<H3> Leave a reply Cancel reply
<H3> Categories

What is “post navigation”? I think it shouldn’t be h2.

Thank you in advance for your consideration.

P.D.: Sorry for my english so horrible

Andrew Misplon Puro Apr 26, 2020 · 9:09 am #14293

Hi Rafa

Thanks for reaching out.

Ultra is using the_post_navigation, you can read more about that function https://developer.wordpress.org/reference/functions/the_post_navigation/. The h2 tags are outputted as part of that function and not directly included in Ultra.

The h2 tags in question are for screen readers so they are never seen by regular browsers, only for those users making use of screen readers.

We can use the following filter to change the WordPress core screen reader markup https://developer.wordpress.org/reference/hooks/navigation_markup_template/.

If you aren’t using a child theme, install a plugin called Code Snippets. Then go to Snippets > Add New, name the snippet as you’d like and insert into the snippet body:

function ultra_navigation_markup_filter( $template, $class ) {
	return str_replace( 'h2', 'span', $template );
}
add_filter( 'navigation_markup_template', 'ultra_navigation_markup_filter', 10, 2 );

Finally, enable the option to run the snippet on the site front-end and click Save changes and activate.

I hope that helps.

Your english is perfect 🙂

2 posts