sesam.hu

🏢 Engineering Manager ⛰ trail runner 🇭🇺 Budapest, Hungary

Analytics plugin bug

You may have noticed a recent issue with comment author links: they had  ‘%20rel=’external%20nofollow” appended to the end of the URL. Apparently this is an incompatibility bug with the Google Analytics plugin by Rich Boakes (v0.68) and the latest release of WP. I found a thread on the WP support forums detailing a fix which I’m happy to say works. Simply change the following line in googleanalytics.php:

function comment_author_link($text) {
	static $anchorPattern = '(.*href\s*=\s*)[\"\']*(.*)[\"\'] (.*)';

To this:

function comment_author_link($text) {
	static $anchorPattern = '(.*href\s*=\s*)[\"\']*(.*\?)[\"\'] (.*)';

Gotta love regexp. :)