#17977 closed enhancement (fixed)
Allow rel attributes on links in KSES
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.5 |
| Component: | Formatting | Version: | 3.2 |
| Severity: | normal | Keywords: | has-patch dev-feedback 3.4-early |
| Cc: | navjotjsingh@… |
Description
Due to the recent Google changes, authors will be wanting to add rel="me" to the links in their author descriptions on blogs they write on. Currently though, rel="me" (and every other rel) is stripped out because it's not an allowed attribute.
I propose we allow it, there seems to be no harm in allowing it and it would help people out. Patch attached.
Attachments (1)
Change History (19)
joostdevalk
— 2 years ago
comment:1
nacin
— 2 years ago
- Milestone changed from Awaiting Review to 3.3
Good to me as long as there are no security issues.
comment:2
hakre
— 2 years ago
+1 from me. If href and title is allowed can't imagine why rel should be worse.
comment:3
joostdevalk
— 2 years ago
Ugh, just thought of an issue. The way this patch is done right now, you'd probably also be able to add rel="me" and rel="author" etc. in a link in the comments which is unwanted behavior I suppose.
comment:5
in reply to:
↑ 4
joostdevalk
— 2 years ago
Replying to nacin:
We could add it to allowedposttags only.
It's already allowed there, I'd like it allowed in author bio's...
comment:6
nacin
— 22 months ago
This whole thing is a mess thanks to how ancient the kses library is and how the globals and constants were implemented there.
Something like this should work as a one-off:
remove_filter( 'pre_user_description', 'wp_filter_kses' );
add_filter( 'pre_user_description', 'wp_filter_pre_user_description' );
function wp_filter_pre_user_description( $data ) {
$allowedtags = $GLOBALS['allowedtags'];
if ( isset( $allowedtags['a'] ) )
$allowedtags['a']['rel'] = array();
return addslashes( wp_kses( stripslashes( $data ), $allowedtags ) );
}
comment:7
joostdevalk
— 22 months ago
Ugh that is ugly. Anyway we can fix that in a less ugly way? If it involves rewriting kses, i'm up for that with some help :)
comment:8
jane
— 21 months ago
- Keywords 3.4-early added
- Milestone changed from 3.3 to Future Release
At this point we're past freeze, and and are switching over to "bugs only" mode. Punting and marking for 3.4-early. If you guys figure out what to do about kses etc., this ticket can be one of the first things in 3.4.
comment:9
jlevandowski
— 21 months ago
Related #18649
comment:10
SergeyBiryukov
— 15 months ago
Related: #20210
comment:11
navjotjsingh
— 11 months ago
- Cc navjotjsingh@… added
comment:12
SergeyBiryukov
— 9 months ago
Related: #21825
comment:13
ryan
— 9 months ago
- Milestone changed from Future Release to 3.5
comment:14
ryan
— 9 months ago
- Resolution set to fixed
- Status changed from new to closed
In [21790]:
comment:15
nacin
— 9 months ago
In [21795]:
comment:16
nacin
— 9 months ago
In [21796]:
comment:17
nacin
— 9 months ago
[21790] is a work of art. <3
comment:18
technosailor
— 9 months ago
Maybe include support for data-* attributes to be HTML5 ready?
Patch of KSES filter to allow rel attribute on links.