WordPress keeps substituting & in URLs that have & (5 posts)

  1. trudiecalling
    Posted 6 years ago #


    I have to include links to a bunch of urls that include ampersands (a typical URL is http://shop.avon.com/shop/surveys/anew2/survey_preloader.asp?case_flag=4&action_flag=1&survey_id=2&language_id=1&calling_application=onlinestore&repid=9023156 ).

    But WordPress keeps on replacing the "&" character with "&"--even though these are clearly coded as links.

    How can I turn this off? It's making all my links unusable. I can edit them over and over again to make them correct, but it's a huge pain.

    Thanks so much!

  2. trudiecalling
    Posted 6 years ago #

    That's replacing the "&" character with & a m p ; -- forgot that would not display.

  3. Francis Crossen
    Posted 6 years ago #

    When you output X/HTML to a browser you should encode ampersands:
    - http://example.com/?foo=a&bar=b
    should be sent as:
    - http://example.com/?foo=a & a m p =b (without spaces!)

  4. trudiecalling
    Posted 6 years ago #

    No, that's the problem. With the encoded ampersand, the links don't work. So I have to UN-encode them. Is there a way to turn encoding off? WordPress is doing it automatically.

  5. Francis Crossen
    Posted 6 years ago #

    Where (post/page/etc) and how are you adding the links? Are you using the WISYWIG editor to create the link or doing it in raw HTML?

    Are you copy/pasting the link into a post as you did above? If so then WordPress treats it as text and will escape it.

Topic Closed

This topic has been closed to new replies.

About this Topic