• Resolved clgrmn

    (@clgrmn)


    Why is it that WordPress can’t handle my <main> – tag?!
    I have already checked every single tag if it is closed.

    I’ve got following site structure:

    <main>
    <section></section>
    <section></section>
    </main>

    Which get me this:

    <p></p>
    <main></main>
    <p></p>
    <section></section>
    <section></section>

    But if i just change the <main> – tag into a <div> – tag it works like it should.

    <div class=”main”>
    <section></section>
    <section></section>
    </div>

    What is wordpress doing with my main tag?!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Can you explain the context of what you’re doing?

    Thread Starter clgrmn

    (@clgrmn)

    I have a local installation of wordpress with understrap as a parent theme.

    I just wanted to try something in the wordpress editor, created the structure as told above and wanted to inspect it in chrome.

    But I already figured out what is probably causing the problem. I had following function in my functions.php to remove empty <p> – tags.

    
    add_filter('the_content', 'remove_empty_p', 20, 1);
    function remove_empty_p($content){
       $content = force_balance_tags($content);
       return preg_replace('#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content);
    }

    After removing this function the main tag is closed as it should be. (after the sections)

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

The topic ‘Closing – tag’ is closed to new replies.