WordPress.org

Ready to get started?Download WordPress

Forums

Anchor links within posts? WP keeps messing it up (5 posts)

  1. michaelcropper
    Member
    Posted 2 years ago #

    I am trying to add anchor links within my long blog post as follows....

    section1
    ...
    ...
    ...
    <h2 id="section1">section1</h2>

    Although whenever I try to do this WordPress keeps overwriting the code... id="section1" .. to .. id=\"section1\""..

    It is escaping the " character as it thinks that this is part of the ID attribute.

    I have tried inserting the ID attribute both via the editor and via the HTML and each time I save the post then it gets overwritten.

    Does anyone have any idea how to get around this?

    Thanks
    Michael

  2. Hmm - I've never seen this issue - perhaps it's some server setting that is "escaping" (putting the backslash) before your quotes.

    But I recommend trying single quotes as a workaround:

    <h2 id='section1'>section1</h2>

  3. michaelcropper
    Member
    Posted 2 years ago #

    Yes it is definitely something that is escaping the " s

    I have just tried using single quotes ' ' instead of double quotes " " and it is the exact same issue. (good suggestion though as I hadn't tried that)

    What I have noticed is that (how ever method I try this) then when I enter them in first then click on publish, the anchor links work. Although when I click on update again (say after adding a new sentence or something) then it reverts to escaping the characters again.

    I can only assume it is a problem with WordPress. I have had a good look round on Google and can't find anyone saying how to solve this issue.

    Thanks
    Michael

  4. Have you tried turning off all plug-ins to see if the problem goes away? Some plug-ins apparently have this effect.

    http://stackoverflow.com/questions/2060776/remove-escaped-quotes-from-wordpress-posts

  5. michaelcropper
    Member
    Posted 2 years ago #

    Thanks for the help Zoonini, whilst waiting for a reply I actually figured out a way around it which involves turning off a WP setting which means I can now add anchor links in WordPress :-)

    I have added the additional info on this subject from the link you have spotted to the blog post.

    I guess this happens quite a bit when there are so many different WordPress plugins which could conflict with each other.

    Thanks for all the help, it has made my day fixing this problem as now my latest blog post (which is about to launch) is a lot more user friendly.

    Michael

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.