• I am using anchors to allow users to find specific spots on a given page of my site. When I edit a page with them on it, I am finding that even though I don’t touch that line of html code… It disappears when I update other areas of the page. I then have to go back in and add the anchors again since they are gone.

    Anyone else experiencing this or have a solution?

    Thanks!

    Ted

Viewing 7 replies - 1 through 7 (of 7 total)
  • I am also having this problem constantly! Would like to know if there is a way to fix this. It’s very annoying.

    Joel Williams

    (@joelwills)

    Automattic Happiness Engineer

    Unfortunately these can sometimes be stripped out when switching between the Visual and Text Editor. If you stay in the Text editor view when editing and saving these won’t be lost.

    I have this problem as well with <a id="Foo" class="anchor"> tags. But it’s not even consistent. Some anchors stay and some don’t. I’m not sure why. When I put text inside the <a> tags, the anchor stays (so far…) but the text miraculously moves to outside the </a> tag.

    I think I figured out why some anchors stay and some don’t, and why they are disappearing at all, and how I can work around it.

    WordPress seems to disappear tags with no content inside them, e.g. <span id="foo"></span>. This behavior makes sense to me in most cases.

    However, if you put <a id="foo"></a> immediately after something (i.e. with no line of whitespace between the anchor and whatever text/markup is before it), then it stays. My guess is that WordPress recognizes this as an anchor, but for some reason assumes that anchors will always appear after what they are anchoring, but not before. So it only recognizes it if it’s immediately after something. I can live with this.

    However, it appears the anchor also has to be followed by non-marked-up text. So now I’m stuck again. I think anchors should be more permissive. I wonder why they are not?

    Sticking the empty anchors inside another tag that won’t be deleted also seems to work.

    Note to WordPress: This is a horrible, horrible kludge and needs to be fixed.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    It sounds more like a bug than a design choice implemented by WordPress, can you create a new thread about it? This thread is regarding WordPress 3.7.1.

    http://wordpress.org/support/forum/how-to-and-troubleshooting#postform

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Anchors on pages disappear’ is closed to new replies.