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

Tagged: 

  • Author
    Posts
  • #14292

    Rafa Monllor
    Participant

    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

    #14293

    Andrew Misplon
    Keymaster

    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 🙂

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Scroll to top