WordPress.org

Ready to get started?Download WordPress

Forums

Unescaping data? (2 posts)

  1. graey
    Member
    Posted 3 years ago #

    Hello all, time for my second problem. Probably a simple one and one I've encountered before in non-wordpress situations, but I can't seem to figure it out this time...
    I wpdb->escape all my data before I insert it into the database, and obviously this adds some \'s in front of each quote and so on. However, obviously I'll also need to remove these once displaying the data again.
    I can't seem to figure out if there's a recommended way within wordpress for this. Is there, and if so, which?
    All I seem to find is people saying you don't need to this anymore with wordpress, yet I seem to be needing to? Am I doing something wrong?
    Thanks in advance :)

  2. s_ha_dum
    Member
    Posted 3 years ago #

    Use $wpdb->prepare() to insert data. To unescape, probably stripslashes_deep() though a lot of buit in WordPress functions handle that for you. Also, there are a lot of nifty functions in wp-includes/formatting.php

Topic Closed

This topic has been closed to new replies.

About this Topic