Allowing Code to Pass through the TinyMCE Filter
-
I’m having trouble trying to allow code to filter through the editor.
This is an example of the code:
<p style="width:33%;min-width:200px;float:left;padding:0 0 10px 0;" align="center"><span style="width:180px;margin:auto;display:block;"><a href="https://bubbajuju.com" target="_blank" rel="nofollow" style="text-decoration:none;"><span style="overflow:hidden;display:block;width:178px;height:178px;line-height:173px;border:1px solid #999999;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;"><img src="https://ecx.images-amazon.com/images/I/4194MAL5TPL._SX300_.jpg" style="max-width:178px;max-height:178px;vertical-align:middle;" alt="Good Controller" /></span><span style="display:block;padding:5px 0;font-size:12px;font-family:Arial;">Good Controller</span><span style="margin:auto;padding:2px 5px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;border:1px solid #ab4b05;background:#ff9900;color:#ffffff;font-size:12px;"><b>CHECK PRICE</b></span></a></span></p>
The tinymce filters are stripping min-width, display:block and border-radius from the code in the author role.
I just want to add these to the tinymce extended valid elements (I don’t want to lose the other filters)
Here is the php I am trying to use:
function override_mce_options($initArray) { $opts = 'p[minwidth|display|borderradius]'; $initArray['extended_valid_elements'] = $opts; return $initArray; } add_filter('tiny_mce_before_init', 'override_mce_options');
Here is a link to a different approach. I just can’t figure out how to syntax the attributes.
https://vip.wordpress.com/documentation/register-additional-html-attributes-for-tinymce-and-wp-kses/
Any help is always so appreciated.
- The topic ‘Allowing Code to Pass through the TinyMCE Filter’ is closed to new replies.