Skip to content

Instantly share code, notes, and snippets.

@Pross
Created August 19, 2025 15:22
Show Gist options
  • Save Pross/f6f4eb355c850acce5b75bcca618e3db to your computer and use it in GitHub Desktop.
Save Pross/f6f4eb355c850acce5b75bcca618e3db to your computer and use it in GitHub Desktop.
Force WP to encode emoji as HTML entities rather than Unicode for ancient or misconfigured db servers that are not mb4 compatible
/*
* Force WP to encode emoji as HTML entities rather than Unicode for
* ancient or misconfigured db servers that are not mb4 compatible
*/
add_filter( 'fl_builder_before_update_layout_data', function( $data, $status, $post_id ) {
foreach ( $data as $node => $node_data ) {
if ( 'module' === $node_data->type && 'rich-text' === $node_data->settings->type ) {
$data[ $node ]->settings->text = wp_encode_emoji( $data[ $node ]->settings->text );
}
}
return $data;
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment