Stop wordpress from removing HTML attributes

I try to insert a post with html tag with class attribute, like this: <dl class="dl-horizontal">, but after saving the post, WP removes an attribute.
How can I fix it?
The only way I’ve found, is to make a shortcode:

add_shortcode('attr', 'html_attr');
function html_attr( $atts, $content = null ){
 extract( shortcode_atts( array(
    'tag' =>"",
    'attr'=>""
  ), $atts ) );   
  return "<" .  $tag . " " . $attr . " >";
}

But I don’t think that it’s a right way…

4 s
4

Please look at the TinyMCE Advanced plugin.

http://wordpress.org/extend/plugins/tinymce-advanced/

You can configure it to leave certain tags alone.
it’s really useful.

Leave a Comment