Saving links to database adds slashes (3 posts)

  1. sketchbob
    Posted 9 years ago #

    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?

  2. whooami
    Posted 9 years ago #

    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.


  3. sketchbob
    Posted 9 years ago #

    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. :-)


Topic Closed

This topic has been closed to new replies.

About this Topic