Hi I’m using this code to replace all the words “Oil” on my blog pages with the words “Olive”
`function replace_text($text) {
$text = str_replace(‘oil’, ‘olive’, $text);
return $text;
}
add_filter(‘the_content’, ‘replace_text’);
The problem is that internal links containing the word “Oil” are also replaced, generating invalid links, 404. I would need a function that recognizes the links, and replaces only the text, not the links. The code posted works well. Except that if I have a link inside the page like