6

I found that CJK article in my wordpress4.7 can't break lines properly,which contain both CJK and english characters.
Here is the article before publish.

enter image description here

All the lines breaked properly before publish.

enter image description here

Now it displayed as below after published. All lines messed ,breaked bad-formatted as unexpected way.

enter image description here

I had tried to fix it this way.

vim  /var/www/html/wp/wp-content/themes/twentysixteen/style.css 
.site-inner {
    margin: 0 auto;
    max-width: 1320px;
    position: relative;
}

.site-content {
    word-wrap: break-word;overflow:hidden;
    word-break:break-all;white-space:pre-wrap;
}

To restart apache and wordpress,no effect at all.
My wordpress version is 4.7,theme is twentysixteen.

showkey
  • 482
  • 42
  • 140
  • 295

3 Answers3

2

try to add this code in your functions.php theme file

    function my_tinymce_fix( $init )
    {
        // html elements being stripped
        $init['extended_valid_elements'] = 'div[*], article[*]';

        // don't remove line breaks
        $init['remove_linebreaks'] = false;

        // convert newline characters to BR
        $init['convert_newlines_to_brs'] = true;

        // don't remove redundant BR
        $init['remove_redundant_brs'] = false;

        // pass back to wordpress
        return $init;
    }
    add_filter('tiny_mce_before_init', 'my_tiny_mce_fix');
Sofiane Achouba
  • 584
  • 2
  • 6
1

Try word press plugin. TinyMCE Advanced

There is option to disable automatically remove of br tag and p tag from setting page of plugin.

Ashish Patel
  • 3,551
  • 1
  • 15
  • 31
0

Install Don't Muck My Markup

Don't Muck My Markup is a plugin that will allow you to

disable all auto-generated HTML markup from your posts and pages on a page-by-page basis.

It adds a small box in the default WordPress editor to turn off automatic markup / formatting for that page/post

This means that can keep all other pages the same and just disable the automatic formatting only for the page / post you're currently editing

Then,

when you have a page/post with mixed content, disable the automatic formatting for that page/post and manually add html mark up like <h1> <br> <hr> <p> and so on