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
- Disable wpautop plugin - But existing articles are affecting
- TinyMCE advanced - does not meet the above requirements
Advanced TinyMCE config - force_br_lines: true, force_p_lines : false
Appreciated any help.
Finally I get solution after hard time. Hope it will be useful for others.
Follow the steps as below.
Install Advanced tinymce config Plugin -
Advanced Tinymce Config
Edit the settings page and add the below custom variables
wpautop false
force_br_newlines true
force_p_newlines false
Install Toggle wpautop Plugin - Toggle wpautop
Go to Settings -> Writing -> Auto disable new posts
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.