• Resolved dkurth

    (@dkurth)


    I keep getting a ‘\’ everything a ‘ is entered. For example “Let’s Ride” comes out as “Let\’s Ride”, when I store it into the database. So the raw field from the CMB2 is returning this error. How can I fix that?

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Very likely the default sanitization callbacks for the field. Which field type is this for? Textarea is my guess until told otherwise.

    Check out https://github.com/CMB2/CMB2/wiki/Field-Parameters#sanitization_cb

    I’d need to dig through the code to see if I can locate the default sanitization function. I think it’s sanitize_text_field()

    Thread Starter dkurth

    (@dkurth)

    Perfect!

    Since I already have built in the software my own sanitize_text_field and the equivalent for the email and URL’s: filter_var($Record[‘link’], FILTER_SANITIZE_URL); and
    filter_var($Record[’email’], FILTER_SANITIZE_EMAIL);

    This should help! Thanks!!

    Thread Starter dkurth

    (@dkurth)

    I did try all this, but while I tried to filter it with sanitize and such, the /’ remains on any apostrophe. Any other thoughts?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Thread Starter dkurth

    (@dkurth)

    ahead of you. Already did that…still there. Saw the same page. But I will give it a second look.

    • This reply was modified 6 years ago by dkurth.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Are you running it before output on the frontend or trying to prevent them in the saving? There’s valid reason to keep them for the database side.

    Thread Starter dkurth

    (@dkurth)

    HUMMM, good point. yes, I just checked. upon saving to the database. But that is a good point, I will go through both of them again..

    Thread Starter dkurth

    (@dkurth)

    ok, I missed one of them. Great catch. Thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘back slash after every ‘ is being displayed’ is closed to new replies.