That should work fine. I’m not sure what issue you’re describing. You’re NOT trying to use regex, correct?
Exactly, no regex nothing… but I beleive I found the problem.
What happens is Space are converted to “ ” and quotation mark are being removed. I think it have to do with WordPress doing something AFTER your plugin, could it be the case ?
https://stackoverflow.com/questions/5940854/disable-automatic-formatting-inside-wordpress-shortcodes
Could wordpress be formating the “Replace text” after your hook ?
If so, could I place your code AFTER the wpautop ?
Thank for the help, really appreciated π
The plugin has been designed to be the last thing that runs i.e. after plugins, themes, etc. So I can’t see additional formatting being applied after my plugin. The only exception are caching plugins which are still able to cache pages modified by my plugin and deliver those cached pages.
Have you tried building the rule in pieces? For example, replace myword with >myword< and if that works add more and more to the span tag until something stops working. It might provide a clue as to the problem.
Caching is disable right now, but good to know π
Ok, I found the problem by doing 2 test:
Test 1:search myWORD | replace potato
myWORD present in main Content and also Footer
Works perfectly
Test 2: search myWORD | replace “potato” (WITH quotation)
myWORD present in main Content and also Footer
myWORD in Content is replace with quotation
myWORD in the footer is MISSING (not even present in the source code).
I’m using Elementor Pro to create the footer (I guess it inject it at some point). I strongly suspect that somehow Elementor FOOTER “retouch” your code. as it works perfectly with the main content (also created with elementor, just not injected). Not sure how to progress next…
Ok, just to inform. If I use Quotation mark in the replace field I cannot edit the page with Elementor (It’s stuck on loading with the big E).
So I guess you something in this plugin break Elementor if quotation are used.
Thanks for letting me know. I use quotation marks in my rules all the time so perhaps there is something special with the Elementor theme.
I’ve done a bit further test, and it really point to “where” this plugin is searching:
I’ve added a str_replace in my function.php and it works flawlessly in the $content section, but it cannot catch the footer. I’ve also found code that use $buffer (trying to catch the final HTML), but this also didn’t work (while working perfectly in the $content section).
So it’s either a question of “Region” (not sure if it’s the right wp term)
or Elementor is being called at the end bypassing everything…
Hope this can help if others have the problem, thank for the support π
Awesome plugin BTW
Thank you for the additional information. This is the first theme that has shown this behavior. Are you using the free version of theme? If so, I’ll have to try it out.