在后台编辑器Text和Visual切换时,部分代码丢失的解决方法
function fix_tiny_mce_before_init( $in ) { // You can actually debug this without actually needing Advanced Tinymce Config enabled: // print_r( $in ); // exit(); $in['valid_children']="+a[div|p|ul|ol|li|h1|span|h2|h3|h4|h5|h5|h6]"; $in[ 'force_p_newlines' ] = FALSE; $in[ 'remove_linebreaks' ] = FALSE; $in[ 'force_br_newlines' ] = FALSE; $in[ 'remove_trailing_nbsp' ] = FALSE; $in[ 'apply_source_formatting' ] = FALSE; $in[ 'convert_newlines_to_brs' ] = FALSE; $in[ 'verify_html' ] = FALSE; $in[ 'remove_redundant_brs' ] = FALSE; $in[ 'validate_children' ] = FALSE; $in[ 'forced_root_block' ]= FALSE; return $in; } add_filter( 'tiny_mce_before_init', 'fix_tiny_mce_before_init' );
在functions.php中加入这段代码,亲测有效