WordPress.org

Support

Support » How-To and Troubleshooting » Saving links to database adds slashes

Saving links to database adds slashes

  • Hi,
    I’ve developed a plugin with an options form that allows me to save some default data.

    If I type an HTML link into the textarea of the form…
    <a href="http://alink.com/test/" >A Link </a>

    it gets saved in the database as…
    <a href=\"http://alink.com/test/\" >A Link </a>

    Is this something WordPress is doing, or is it a magic quotes thing, or both?

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

    @whooami

    Member

    thats an example of escaped quotemarks

    ( \ == escaping )

    and quite normal

    is the output what you want? THATS the important thing.

    Laymens Lesson:
    You escape quotemarks like that because you dont and cant have PHP using those particular quotemarks to determine output. In other words, escaping them makes them basically just more text to PHP.

    http://www.google.com/search?q=escaping+quote+marks&btnG=Search&hl=en

    I see. So it’s coded to do that in wordpress and not because of magic quotes.

    I used stripslashes to fix it while waiting for a reply. I just wasn’t sure if it was the wptexturize thing, or magic quotes or what that was causing it.

    Now I know. 🙂

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Saving links to database adds slashes’ is closed to new replies.