title: How do I replace the text to a link in php?
body: <p>I have the following function in my wordpress website, works well with page text......</p>
  
  <pre><code>function replace_text($text) {
      $text = str_replace('Cookbook', 'All Recipes', $text);
      $text = str_replace('look-for-that-string', 'replace-with-that-string', $text);
  return $text;
  }
  add_filter('the_content', 'replace_text');
  </code></pre>
  
  <p>But what I'm trying to target is text that is generated by a menu plugin,....
  I've tried by adding the actual element code (below) in it's entirety but it does not change the menu text. It still say "Cookbook" I can't touch the menu plugin code unfortunately.</p>
  
  <pre><code> function replace_text($text) {
       $text = str_replace('&lt;span class="145-test 120-test 115-test loaded- 
  header"&gt;Cookbook&lt;/span&gt;', '&lt;span class="145-test 120-test 115-test loaded-header"&gt;All Recipes&lt;/span&gt;', $text);
  $text = str_replace('look-for-that-string', 'replace-with-that-string', $text);
  return $text;
   }
   add_filter('the_content', 'replace_text');
  </code></pre>
  
  <p>Is there something I need so that it switches the text?</p>
  
  <p>does it have to do with the_content?</p>