Wordpress keeps adding <a> tags

193 views Asked by At

So while I am working with Wordpress and the OceanWp Theme (in the HTML Editor), everytime I am adding a tag anywhere in my Code, Wordpress keeps adding tags over and over again to my HTML Code. The problem only occurs with the tags.

For example I have these lines of code:

<div class="div_wrapper">
<div class="mid_section">Test

</div>
</div>

Now what I want for example is a clickable so I am adding the first tag in:

<a href="http://example.com">

<div class="div_wrapper">
<div class="mid_section">Test

</div>
</div>

</a>

So from now on, everytime I am tapping out of the Editor, Wordpress will do this:

<a href="http://example.com"></a>

<a href="http://example.com">
</a>
<div class="div_wrapper"><a href="http://example.com">
<div class="mid_section">Customize your own learning plan

</div>
</a>

That's whats happening after 3 times tapping out:

<a href="http://example.com"></a>

<a href="http://example.com">
</a>
<div class="div_wrapper"><a href="http://example.com">
<div class="mid_section">Customize your own learning plan

</div>
</a><a href="http://example.com"></a><a href="http://example.com"></a>

I guess you can see the problem.

This keeps happening over and over again and I really don't know what I am doing wrong here.

Hope someone can help me.

1

There are 1 answers

4
Uri Chachick On

the problem is that it's not ok to put a "div" (which is a block element) inside an "a" (which is an inline element). the code should be:

<div class="div_wrapper">
    <div class="mid_section">
        <a href="http://example.com">
            Test
        </a>
    </div>
</div>