Wordpress - TinyMCE Advanced newline problem
Go into Settings -> TinyMCE Advanced, and check the option Stop removing the <p> and <br /> tags when saving and show them in the HTML editor
. This will allow you full control over those tags inside the HTML view.
For a single line break without overriding the editor, use Shift+Enter
.
To override the editor and make Enter
a single line break, put this into your functions.php
:
function change_mce_options($init){
$init["forced_root_block"] = false;
$init["force_br_newlines"] = true;
$init["force_p_newlines"] = false;
$init["convert_newlines_to_brs"] = true;
return $init;
}
add_filter('tiny_mce_before_init','change_mce_options');
This does not convert shift+enter
into <p></p>
however, and this will cause some strange behavior for already existing content (if you're inside an existing <p>
it will give two lines instead of one), so I would strongly recommend getting used to shift+enter
instead.