In my Wordpress post I click on edit post and skip over to the html editor tab and click on it. I have a pre on that page and when i give it a rel and publish its all fine but when I skip back over to visual editor it just takes out the rel attribute.
1 Answer
function extend_tinymce( $values ) {
$elements = 'pre[id|class|title|rel]';
if ( isset( $values['extended_valid_elements'] ) ) {
$values['extended_valid_elements'] .= ',' . $elements;
} else {
$values['extended_valid_elements'] = $elements;
}
return $values;
}
add_filter('tiny_mce_before_init', 'extend_tinymce');
The above snippet is what I use for example, of course you can extend this beyond id, class, title, rel, to things such as height, width, style, name, etc...
pre
?rel
is for links.