I'm using the latest version of WordPress (3.1.1). Is it just me, or is WordPress now automatically linking plain-text email addresses?

I type [email protected] as a comment and it shows up as <a href="mailto:[email protected]">[email protected]</a>

I am working on a plugin that filters comment text using the get_comment_text filter and then subsequently modifies the presentation of the email address. This plugin worked fine before, but like I said, now WordPress automatically links email addresses.

I figured that WordPress would follow its own rules and do it by means of a filter, so I went ahead and added a priority level to my own filter of 9000 figuring that way I can force mine to trigger after WordPress is done sticking its nose in something that's not its business, but this did not work.

I'm wondering if anyone here knows a way around this situation, or at the very least, if someone knowledgeable about the system could point me to the source that is responsible for this automatic linking.

My plugin already has the functionality to work with plain-text emails, but this too is broken because after it modifies the presentation of the plain-text email, WordPress then goes and linkifies it.

EDIT: One Trick Poney pointed me to make_clickable which is responsible for this. It's indeed added as a filter in wp-includes/default-filters.php, with a priority of 9. However, I have already tried, like I mentioned above, to set the priority level to 9000 to make my plugin work after WordPress has done its dirty business. This didn't work, is it because I'm getting the original unfiltered content? I figured I would be getting the filtered content (i.e. the content already linked).

So then I went ahead and activated the plain-text filter (which applies to plain-text emails), and applied it a priority of -9000 so that it gets in before make_clickable, but again nothing good came of this because when make_clickable did fire, it went ahead and figured it'd be a good idea to linkify the links I create. It 'linkifies' the urls in the href attribute of a link, making for very messy output.

So it seems that the best thing to do would be to get in after wordpress has done its business, after make_clickable has fired, but like I said for some reason even though I apply my filter a priority level of 9000, compared to make_clickable whose priority level is only 9, nothing seems to happen. I will continue to investigate.

I can understand and imagine that WordPress devs were trying to be more user-friendly, but this seems to have caused some edge-case problems (ex. linkifying href attributes in already-existing links).

Any help would be greatly appreciated.

EDIT 2: Yep, I just tested my filter with a priority level of 9000, which I would imagine should run after WordPress ' make_clickable whose priority level is 9. My filter gets the unaltered/unfiltered content. I don't know how or why this is happening. I would have imagined that having a later priority I would get the content as it had so far been altered by higher-priority filters, otherwise situations like these (collisions?) would arise, like this one.

  • it's the make_clickable filter applied to comment_text. add your filter with -9000 priority or something like that Commented Apr 18, 2011 at 5:19
  • Thanks One Trick Pony I appreciate it! I was just finding out that it's not limited to email addresses, that it also applies to URLs. I'll investigate. If it works out I'll let you know in case you want to make this an answer. Commented Apr 18, 2011 at 5:31
  • I've added more information to my post in case you might have any ideas. Commented Apr 18, 2011 at 5:51

1 Answer 1


I noticed that wordpress' make_clickable filter was attached to the comment_text filter hook and not get_comment_text, which is what I have been using for a while. I had researched earlier if this may be the case, specifically figuring out what the difference was between the two, and I think I read something about comment_text using get_comment_text, so maybe it was doing something more than once, resulting in the weird output I found.

I solved this by changing my filter to hook onto comment_text instead, that way the priority would matter (duh), and kept my filter's priority level of 9000. Preliminary tests show everything to be working. This way I don't have to worry about wordpress modifying my output in unpredictable ways, instead I can just bother working with what wordpress vomits out. At least that way I know what I can work with and what I can't work with.

Thanks again to one trick pony for giving me a lead.

  • i don't think there's a hook called get_comment_text :) Commented Apr 18, 2011 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.