Created
October 30, 2015 11:36
-
-
Save sidonaldson/67268666c5501f06289d to your computer and use it in GitHub Desktop.
This snippet will tame TinyMCE within Wordpress and prevent it trying to clean up the code and reformat it. Specifically helps to prevent wordpress strip p tags and line-breaks and stops it from inserting nbsp etc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mce_mod( $init ) { | |
$init['forced_root_block'] = 'p'; | |
$init['apply_source_formatting'] = false; | |
$init['preformatted'] = true; | |
$init['force_br_newlines'] = true; | |
$init['wpautop'] = false; | |
return $init; | |
} | |
add_filter('tiny_mce_before_init', 'mce_mod', 99); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment