Add Special Chars to WordPress TinyMCE Char Map

Had an issue where a clients blog post had one of these in the post and it wasn’t being displayed right. The real issue was changing the ‘post_content’ field of the wp_posts table to UTF-8 Unicode (utf8mb4) from cp1252 West European, but (!) along the way I tried this.

Put this in a plugin or functions.php and the elements will show up in TinyMCE’s char map.

Also, here’s a nice char reference.

 

Github Gist

<?php
add_filter( 'tiny_mce_before_init', 'tinymce_add_chars' );
function tinymce_add_chars( $settings ) {
    $new_chars = json_encode( array(
        array( '8224', 'Dagger' ),
        array( '337', 'Double Accute o - lowercase' )
    ) );
    $settings['charmap_append'] = $new_chars;
    return $settings;
}

 

Leave a Reply

Your email address will not be published.