• Hello friends!

    I have a form in my wordpress environment

    <form action="" method="post">
                <textarea name="message"></textarea>
                <input type="submit" value="Post" />
    </form>

    After submitting the form, I receive and store the data with

    $all_data_ever_posted = get_user_meta( $user_id, 'all_data_ever_posted', true );
    if($_POST["message"]) {
                $all_data_ever_posted[] = stripslashes($_POST["message"]);
                update_user_meta($user_id, 'all_data_ever_posted', $all_data_ever_posted);
    }

    When I enter normal things without backslashes and so on, everything is fine and the thing is stored in the database.
    But if I enter e.g. “\test”, the $_POST is rightly transported and put into the array. But when i update the user_meta and get_user_meta the next time, the “\” is gone!

    What am i doing wrong?
    Please tell me the correct way to store special characters in the custom fields of wordpress.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter vielhuber

    (@vielhuber)

    nobody?

    Thread Starter vielhuber

    (@vielhuber)

    How can i submit special characters in my custom fields?
    Backslashes simply disappear after a get_user_meta.

    Thread Starter vielhuber

    (@vielhuber)

    Fixed.

    Before saving:

    $message = htmlentities(stripslashes($_POST["message"]),ENT_COMPAT,"UTF-8");
    $message = str_replace("\\","\",$message);

    Before output:
    $message = str_replace("\","\\",$entry);

    Thread Starter vielhuber

    (@vielhuber)

    oops
    $message = str_replace(“\\”,”& # 9 2 ;”,$message);
    without the spaces between!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘get_user_meta destroys backslashes!!!’ is closed to new replies.