The keywords array is a simple array I’ve created to determine what keywords will be replaced with what links.
The code is being run over the variable that holds the main content for the page. It replaces the keywords (once only) with the links if it finds them. This was fine until I started adding tags to my content. It’s now adding the link into the alt text of the image if it finds the keyword there first!
Nevermind, solved by pregmatching the image html, removing it before processing the link replacements and then added it back after! Had a flash of inspiration!