Ashley Cameron Design

Ashley Cameron Design

Shop the Creative Design Market

Good morning

Add rel attribute to Tinymce Editor

SnippetsWordPress

About a 1 minute read

"I am always doing what I cannot do yet, in order to learn how to do it."

Vincent Van Gogh


1
2
3
4
5
6
7
8
9
//add rel tag to tinymce editor
add_filter('the_content', 'addreltag');
function addreltag($content) {
global $post;
$pattern ="/<pre>/i";
$replacement = '<pre rel="'.$post->post_title.'"$6>';
$content = preg_replace($pattern, $replacement, $content);
return $content;
}