WordPress.org

Ready to get started?Download WordPress

Forums

Saving links to database adds slashes (3 posts)

  1. sketchbob
    Member
    Posted 7 years ago #

    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?

  2. whooami
    Member
    Posted 7 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.

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

  3. sketchbob
    Member
    Posted 7 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. :-)

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic