WPDB->insert with special characters

If the same code works with add_option() and not with $wpdb->insert() in a custom table, it is probably because the collation of the custom table does not support the characters of the inserted data.

It shoulud work if you set the collation of your table to UTF-8, utf8_general_ci at minimum (to allow support for emojis, WordPress uses utf8mb4_unicode_ci since version 4.2).

Leave a Comment