Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Here's the problem: I paste the HTML entity code for, let's say, a service mark (℠) into the HTML view of the editor. As soon as I switch to the "visual" tab, my entity code is turned into an actual service mark character (I guess the corresponding UTF-8 character or something? I don't know from character encodings...). I don't want this--I want it to stay as the entity reference.

Is there some kind of configuration I can change to stop TinyMCE from doing this? My understanding from reading the internets is that this is not the default behavior--that TinyMCE should actually be doing the opposite, and converting characters to their entities. So is this something specific to WordPress' version of TinyMCE?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

According to this page, you can use the tiny_mce_before_init filter, make sure the entity encoding is set to named, and then add whichever special characters you want to the entities array.

share|improve this answer

Thanks, fdsa!

For posterity, here's the actual code I used. It adds copyright, registered, trademark, service mark and euro to the array of allowed entities. I'm confused as to why some of these aren't in there by default, as they're really common. But in any case, this works:

// Custom configuration for TinyMCE
function wpsx_54398_configure_tiny_mce( $initArray ) {

    // Add some common entities to the default array (copy, reg, trade, service mark, euro)
    // The odd entires are the entity *number*, the even entries are the entity *name*. If the entity has no name,
    // use the number, prefixed with a hash (for example, the service mark is "8480,#8480").
    $initArray['entities'] = $initArray['entities'] . ',169,copy,174,reg,8482,trade,8480,#8480,8364,euro';

    return $initArray;

}
add_filter('tiny_mce_before_init', 'wpsx_54398_configure_tiny_mce');
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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