I need to use the html entity $ instead of plain $ in my posts.

I use the Wordpress Classic editor.

I know that tinyMCE, with good intentions, alters its content when switching between HTML and Visual view.

How I am approaching the problem:

I added this to my functions.php

// Avoid tinyMCE mess when HTMl and Visual switch
function override_mce_options($initArray) {
    $opts = '*[*]';
    $initArray['valid_elements'] = $opts;
    $initArray['extended_valid_elements'] = $opts;
    $initArray['entities'] = $initArray['entities'] . ',169,copy,174,reg,8482,trade,8480,#8480,8364,euro,dollar';
    return $initArray;
add_filter('tiny_mce_before_init', 'override_mce_options');

But it won't work.

Entities are still being replaced when switching the views.

Interestingly, the symbol < gets replaced to its entity &lt;. I do not want that same behaviour. Sometimes I do need the plain $ sign (because LaTeX).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.