WordPress.org

Ready to get started?Download WordPress

Forums

Update option in the database with html tags (2 posts)

  1. Asaf Cohen
    Member
    Posted 2 years ago #

    Hello!
    I'm using the update_option function to update a option in the DB.
    The problem is that the update function have html tag protection or somthing like that so it update the content to the database like that:
    Test<br><span style=\"font-weight: bold;\">Bold</span><br><span style=\"font-style: italic;\">Italic</span><br><span style=\"text-decoration: underline;\">Underline</span><br>
    Instead like this:
    Test<br><span style="font-weight: bold;">Bold</span><br><span style="font-style: italic;">Italic</span><br><span style="text-decoration: underline;">Underline</span><br>

    Please help me, Thanks in advanced.

  2. jarrydtrycode
    Member
    Posted 2 years ago #

    I'm assuming that you want to do something with that html code somewhere?

    I have yet to find a way to prevent that function from escaping the quotes, but you could try using the php built-in-function 'stripslashes()' to display the html properly anyway, like so:

    <?php
    
    $display = '<span style=\"font-weight: bold;\">Bold</span>';//the content
    
    echo stripslashes($display);
    
    ?>

    This will display your content as if the update_option function hadn't escaped all the quotes.

Topic Closed

This topic has been closed to new replies.

About this Topic