I would like to create link of word(s) in post content (word(s) which is used as post tag of current post) to post tag URL. I created this, and it works, but only for one word (last tag) of post.
$post_content = get_the_content(); // Get post content $search = array($tag->name); $replace = array('<a href="'.get_tag_link($tag->term_id).'" title="'.$tag->name.'" itemprop="url">'.$tag->name.'</a>'); $replacePairs = array_combine($search, $replace); echo strtr($post_content, $replacePairs);
How to make it search for all words of tags (of current post) in post content and link that words to it's tag URLs?