I had a mad moment of panic thinking that the blog had been hacked or suffered a code injection as I noticed what should have been a link replaced with a seemingly random string of characters.

I jumped into the post in wp-admin to see what was happening and realised that it was due to my new regex pattern for hashtag replacement.

It is more aggressive than the previous pattern to ensure it captures things that one didn't but this means I have had to add more exclusions. One exclusion I forgot was a preceding forward slash meaning any link with a fragment, such as links to comments - url/#fragment, would have the fragment replaced thus breaking the link.

Fixed!

I'll probably find more instances of overly aggressive hash replacement as we go but, for now, it's panic over.

Leave a Reply

Your email address will not be published.