­ hyphenation not working in Gutenberg editor

With the ‘new’ Gutenberg editor the previously working solution using the tiny_mce_before_init hook does not work anymore, but there is the possibility to define a new shortcode in your theme / plugin as a workaround.

Solution for Gutenberg

add_shortcode('shy', 'my_shy_shortcode');
function my_shy_shortcode($atts) {
    return '­';
}

This simply adds a new shortcode to WordPress with a ­ entity as output, so you can just write [shy] anywhere in your text and it will be translated to the HTML entity;

There is currently no ‘cleaner’ solution and it seems that none is planned, at least not before 5.8 (Github issue 1, issue 2)

Solution for the Classic Editor (no Gutenberg)

function override_mce_options($initArray) {
    $initArray['entities'] = 'shy';

    return $initArray;
}
add_filter('tiny_mce_before_init', 'override_mce_options');

This should prevent TinyMCE from filtering out the shy tag, for more information on how to fine-tune this and keep other entities as well read here: https://stackoverflow.com/a/29261339/826194

error code: 523