Links in posts lose href information (0.75)
I’m working to setup a new site with WP 2.1 and bbPress 0.75 So far the integration has worked very well and I’ve primarily been tweaking the themes.
Anyway, one weird thing I’ve noticed is if I include a link in a post (std a href=”") and submit it, the href attribute is stripped out completely. All that is left in the post when I edit it again is the link text surrounded by empty a tags (tried to use & lt ; in my post and it got converted to tags – wild)
I plan to dig through the code a bit and see what might be causing this. I’m not using any plugins beyond the standard WP integration on. It’s a fairly stock install.
If the format isn’t 100%, bbPress has a tendancy to strip the HTML out of the post. It will automatically hyperlink a URL, but if you try doing a simple a href and it strips it, it might have been a missing ” or something. Let us know, but I have no issues with this unless the formatting is not 100% correct.
I tested it multiple times. 100% correct syntax.
a href=”http://url.here” link text /a
No missing quotes, etc. The href attribute is just gone when you submit/edit a post. I’ll dig some more.
It’s happening in the kses pre_post filter. If I comment out the bb_filter_kses add_action in default-filters, the link stays. I see a and href in the allowed_tags array. No clue why it would suddenly yank it out. Been browsing the SVN repository looking for recent changes – don’t see anything major. Very very strange.
I have a fresh install of 0.75 and the latest TRAC version and I can’t replicate this. Anyone else having this problem?
I am having a variation of this. Some links work on a page and others do not. This includes the post information. The oddest thing is that when I view source (via Firefox Developers tool) the links are there and are correctly formed. One page to view, where I know that this is occuring, is this one.
actorjiml: there is a lot of stuff going on with that page making it not XHTML compliant. Check here for your site:
I can’t select any of the discussion text on the page either, like something is preventing it. The source looks fine (other than the errors) and I would guess that whatever is making the text non-selectable is also making the links not work.
Once you are outside the discussion (like the RSS feed link at the bottom, and the Register Link up top) the links work fine. So maybe a misbehaving plugin or template modification is causing the problem with the discussion text.
One other thing: if you disable the CSS, the links work fine.
baptiste: can you post a URL where we can see an example of the problem?
I knew of one item that is a large part of the 34 items. I will address that when I’m home and not at work. Then I’ll be able to see where to go from there. Thanks for taking a look.
Yeah, the alt tag missing is not causing the problem. That was a lot of the errors. Ignoring those errors, there are still others. Two
<body>tags was interesting…
Heh. The 2 body tags was something left over from downloading Trent’s template of this forum. I’ve cleaned up the errors now, leaving only one for target=”_blank” and one for having start=”1″ inside the
<ol>tag which comes from bbPress. It is still occurring. I’m trying to see if there is something in common with the places that it’s happening. The odd thing is the links won’t work on a small part of the page, will on others.
I verified in the database that the href attribute is gone in the record – it’s not ‘hidden’ it’s stripped out. I verified this using a simple echo stmt before and after the filter call and commented out each filter one by one. When kses got commented out – the link returned and worked normally.
Mike Baptiste, maybe I don’t understand how the whole thing works, but in my database, they are stored without the href information, in the bbpress_posts table, and the
<a href=stuff is added upon display. So checking the see that they are not there in the database might not be a valid check. Mine are stored without the href and they display fine and are clickable.
Also, when entering a URL in a post, I don’t enter the href or anything else, I just put the URL in there, with a http://, and it becomes clickable automagically when it’s displayed. Without the http://, it appears that sometimes they are not identified as links by bbPress (especially when there is no www. at the beginning.)
I just registered at your forum, made a post with a link in it, just the URL, and it is clickable. Maybe you’re doing too much work trying to add the
<a href=""> </a>stuff? I never tried to know that it doesn’t work. Things that look like URLs are made clickable by bbPress.
Sorry for the double post. The first time I posted, I got a
408 Request Timeout error:
This request takes too long to process, it is timed out by the server. If it should not be timed out, please contact administrator of this web site to increase ‘Connection Timeout’.
The point of using a href is to hide the URL itself and have a clickable phrase. a is listed as an allowed tag and in kses it appears to be allowed. I can’t understand why it’s being stripped out of the post. It should not be
I’m thinking this problem may be due to the WordPress integration stuff. Same thing with the slashes being included in the posts. I may mess around with the integration plugin a bit and see if including the wordpress APIs is the root cause and why.
baptiste said: “The point of using a href is to hide the URL itself and have a clickable phrase. a is listed as an allowed tag and in kses it appears to be allowed. I can’t understand why it’s being stripped out of the post. It should not be”
Good point. I forgot I can do that with mine and it works fine. I am not using any WordPress integration plugin for mine – just user registrations are integrated. What integration plugins are you using and what does it get you?
I used the instructions here but stopped short of the cookies. I think all that is ‘integrated’ in mine are user accounts. Maybe I didn’t complete the integration and that’s why mine is acting different than yours.
(edit: the link to “here” works exactly like you want it to in your install, but it does not. I grok your problem now. )
Basically the part causing problems is using the require of wp-config. THis gets you the wordpress API in bbPress. I use this to have my widget sidebar in my bbPress pages. When you do this, bbPress uses the kses.php library from WordPress instead of bbPress. It makes sense – the library is generic. Why load it twice (plus the function names would conflict)
But something with kses 0.2.2 is stripping out attribute lists. I’ve been debugging it all morning and I can’t figure out why. I get so far as to see in wp_kses_attr that after checking for allowed protocols, no attributes come back. Still digging.
Any luck on this? I’m having this problem too. WP 2.1 bbPress 0.8, integration seems to be working other than this. Thanks!
Hi, I am interested in having a link not only be automatically turned into a hyperlink within the post but in addition to this also I would like to add: target=”_top” such that the tag would be here
Any hints where to find the function to modify?
Many thanks and encouragements,
Cordoval: this is over a year old so you might want to start a new topic. I think I saw another topic where you posted something similar. You might want to post your problem as a new topic, then link to the research you’ve already done.
You must be logged in to reply to this topic.