Wordpress WYSIWYG editor automatically adding span classes with style

久未见 提交于 2019-12-22 11:35:18

问题


For some reason my WYSIWYG editor in Wordpress automatically adds span classes with style when I create a bullet list with the button. It's very annoying because I want my text to be a certain size, but the span class hardcodes the style and it messes the size up.

Does anyone know how to remove this automatic adding of the span class?

This site is for a customer and he/she doesn't know how to use HTML, that is why this has to work with the WYSIWYG editor.

Help much appreciated. Thanks.


回答1:


I have the same problem, and I am not copying, each time I create a list, the editor adds in the code:

the text

to the text of the list.

How can I get rid of this ?


I have just find a solution that works for me in that post: http://wordpress.org/support/topic/strange-behaviour-making-lists-in-the-visual-editor

If you use a child theme, just add this function to your functions.php file:

 /**
 * I want to use the basic 2012 theme but don't want TinyMCE to create
 * unwanted HTML. By removing editor-style.css from the $editor_styles
 * global, this code effectively undoes the call to add_editor_style()
 */
add_action( 'after_setup_theme', 'foobar_setup', 11 );
function foobar_setup() {
  global $editor_styles;
  $editor_styles = array();
}



回答2:


Are you copying and pasting the text from somewhere? Sometimes the text will have styles in its source and the styles get carried over to the wysiwyg. See http://tentblogger.com/copy-paste/



来源:https://stackoverflow.com/questions/14468117/wordpress-wysiwyg-editor-automatically-adding-span-classes-with-style

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!