WordPress TinyMCE use U instead of style text docration underline

does anybody know how to change functionality of button in wordpress content textarea of tinymce? There is a “u” button (underline) which makes text

<span style="text-decoration-line: underline;">text underlined</span>

what I need is change functionality of this button to put in content:

Read More
<u>text underlined</u>

I know that i need to change the tinymce init but where can i find it? What do i have to write there? I need this in my wordpress blog, so please help me 🙂

Related posts

1 comment

  1. You can create your own shortcode to accomplish this. Add the following to functions.php and you may use [u] and [/u] around whatever should get <u>-tags.

    function underline_shortcode( $atts, $content = null ) {
        return '<u>' . $content . '</u>';
    }
    add_shortcode( 'u', 'underline_shortcode' );
    

    Another solution, add this to wysiwyg.php after tinyMCE.init {...

    inline_styles: false,
    formats: {
        underline: { inline: 'u', exact : true }
    }
    

    This should force the present button to serve you with the good old tags. Although this is not recommended since u-tags are deprecated. (Source: Underline format problem)

Comments are closed.