drinkmaker
7/20/2016 - 8:51 AM

stop wp removing some html tags in editor (So stupid feature)

stop wp removing some html tags in editor (So stupid feature)

<?php 

// stop wp removing some html tags in editor (So stupid feature)
function esta_tinymce_fix($init) {
    // html elements being stripped
    $init['extended_valid_elements'] = 'div[*], article[*], span[*], strong[*], pre[*], h1[*], h2[*], h3[*], h4[*], h5[*], h6[*], b[*], i[*], tt[*], em[*], font[*], a[*], p[*], br[*], blockquote[*], dt[*], dd[*], ol[*], li[*], ul[*], li[*], img[*], hr[*], form[*], select[*], option[*], textarea[*] input[*], table[*], tr[*], td[*], th[*]';
    
    // don't remove line breaks
    $init['remove_linebreaks'] = false;

    // don't remove redundant BR
    $init['remove_redundant_brs'] = false;

    // pass back to wordpress
    return $init;
}
add_filter('tiny_mce_before_init', 'esta_tinymce_fix');

?>