I am storing emojis into a custom table and querying the content using wpdb variable. The database charset is utf8mb4 and collation is utf8mb4_general_ci

Emoji are stored as it is as the user enters them. What security issues can i face here and what things should i keep in mind to avoid any situation that could compromise my data. Also can user insert some random mysql/php code in input, should i sanitize it, encode it and then store. Also if i do encode at what stage should i decode it to present to ui.

1 Answer 1


As with all user input, you will want to sanitize before storing the input, sanitize on display, and sanitize any user input used in queries. If you're limiting it strictly to emojis, I would also recommend validating and restricting input to only emojis.

  • Thank you, makes sense.
    – Pawan
    Commented Oct 18, 2019 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.