Stop br from disapearing when toggling between editors
-
Hello,
I have read and tried at least 20 different approaches for toggling between the visual editor and the text editor. I have WP Edit installed. Disabling the visual editor is not an option here.I tried putting the following code in my functions.php file under my themes:
remove_filter('the_content', 'wpautop'); remove_filter('the_excerpt', 'wpautop'); remove_filter('comment_text', 'wpautop', 30);
I tried Tiny MCE Advanced plugin, I tried toggle wpautop plugin, none of these worked in WordPress version 4.0.1 nor the latest 4.1.1
I even tried to set, inside the formatting.php :
function wpautop($pee, $br = false)
no luck there either.
I am a new admin for WordPress Multisite for a very large company that deploys at this time over 80 WP sites and my boss wants me to get this done because he’s sick of the disappearing line break. I told him about the adding an attribute to the br like
<br class="none" />
but apparently that is not good enough.We are in the process of trying to update to 4.1.1 but need to test a lot of plugins, so 4.0.1 for now.
Is it even the wpautop filter that I am talking about or some other Tiny MCE Editor snafu (I realize this is in place on purpose and am on the side of why o why…)
Also in my funtions.php is this code I tried altering from GIT:
function improved_trim_excerpt($text) { global $post; if ( '' == $text ) { $text = get_the_content(''); $text = apply_filters('the_content', $text); $text = str_replace('\]\]\>', ']]>', $text); $text = str_replace('<br>', '<br class=\"none\" />', $text); $text = str_replace('<br />', '<br class=\"none\" />', $text); $excerpt_length = 80; $words = explode(' ', $text, $excerpt_length + 1); if (count($words)> $excerpt_length) { array_pop($words); array_push($words, '[...]'); $text = implode(' ', $words); } } return $text; } remove_filter('get_the_excerpt', 'wp_trim_excerpt'); add_filter('get_the_excerpt', 'improved_trim_excerpt');
Any help would be awesome, I like this job ??
- The topic ‘Stop br from disapearing when toggling between editors’ is closed to new replies.