Prevent stripping MathML tags on post save

The MathML tags are removed by the editor. TinyMCE (the editor) removes tags that are not in its “valid_elements” list. The MathML tags and tag-attributes must be added via the “extended_valid_elements” list (seen below).

Place the below code in your functions.php file.

function mce4_options($opt){
$opt['extended_valid_elements'] = 'math[class|id|xmlns|altimg|alttext|display|overflow],semantics[encoding|definitionURL],annotation[encoding|definitionURL|cd|name|src],annotation-xml[cd|name|encoding|definitionURL|src],merror,mtext,mspace,mover[accent|align],munder,munderover,mstack,mrow[dir],msrow,mfenced[open|close|separators],menclose[notation],mphantom,msup,msub,msubsup,mmultiscripts,mi,mn,mo[fence],ms,mtable,mtr,mtd,mlabeledtr,mfrac[linethickness|bevelled|numalign|denomalign],mfraction,msline,msqrt,mroot,mscarries,mscarry';
return $opt;
}
add_filter('tiny_mce_before_init','mce4_options',25);

The above code is used on DCJTech (http://dcjtech.info/), so I know it works. However, MathML is part of the HTML5 specification. If using HTML4 or XHTML, remember to use/add the proper MathML namespace.

<math xmlns="http://www.w3.org/1998/Math/MathML">

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)