Slashes issue

Support MB Custom Table Slashes issue

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #41704
    wgstjfwgstjf
    Participant

    Hi guys,

    How can we strip slashes from fields before they're displayed by metabox?

    Screenshot

    Cheers,

    Will

    #41723
    PeterPeter
    Moderator

    Hello Will,

    Which field type you are using? Let me try to reproduce the issue on my local site.

    #41726
    wgstjfwgstjf
    Participant

    The Text field in this case.

    Thanks,

    Will

    #41731
    PeterPeter
    Moderator

    Hello,

    I do not see that issue on my local site, screenshot https://monosnap.com/file/G6nSExPrhxmRCk6HJqPoyejwh4YKdM
    even with a subfield inside a group.

    You can try this again with a fresh install of WordPress and Meta Box plugins to see how it goes.

    #41798
    wgstjfwgstjf
    Participant

    Hi

    I suppose what I'm asking is if slashes are present in the DB data should MB be stripping them before displaying the data in a input field? It is currently not happening at my end.

    Cheers,

    Will

    #41799
    wgstjfwgstjf
    Participant

    Worth noting that this data is in a custom table and for a custom model not, as in your example, the postmeta table.

    Thanks in advance.
    Will

    #41810
    PeterPeter
    Moderator

    Hello,

    If you want to stripe the slashed from the field value after adding in the admin area, please create a custom sanitize callback. The default sanitize function of WordPress does not support striping the slashes, please follow the documentation https://developer.wordpress.org/reference/functions/sanitize_text_field/
    https://docs.metabox.io/sanitization/#custom-sanitize-callback

    If the value is inserted into the DB from another source like Rest API, you can stripe the slashes from the value before inserting it into the DB.

    I've tested with a custom table and see the same results.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.