Hey guys, 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?
firstname.lastname@example.org as a comment and it shows up as
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.