1
votes

I want to enable multiple <br /> tags in the back office editor as user press [SHIFT + ENTER]. Like Gmail Editor.

Otherwise, I need to disable line breaks on [SHIFT + ENTER] and it should just add <p> a tag like normal enter, I know <br /> could not be added then. But this is for Chinese website. So they do not mind line breaks.

I tried

  1. Disable wpautop plugin - But existing articles are affecting

  2. TinyMCE advanced - does not meet the above requirements

  3. Advanced TinyMCE config - force_br_lines: true, force_p_lines : false

    Appreciated any help.

1

1 Answers

0
votes

Finally I get solution after hard time. Hope it will be useful for others.

Follow the steps as below.

  1. Install Advanced tinymce config Plugin - Advanced Tinymce Config

  2. Edit the settings page and add the below custom variables

    wpautop false
    force_br_newlines true
    force_p_newlines false
    
  3. Install Toggle wpautop Plugin - Toggle wpautop

  4. Go to Settings -> Writing -> Auto disable new posts

  5. Even though the post displays fine on website, If you save the post it will format the content in the editor. To disable add this in functions.php

    function skp_disable_wp_editor_formatting()
    {
        remove_filter('the_editor_content', 'wp_htmledit_pre');
        remove_filter('the_editor_content', 'wp_richedit_pre');
    }
    add_action( 'media_buttons', 'skp_disable_wp_editor_formatting');
    

Thats it.