#12464 closed defect (bug) (duplicate)
Text links are stripped from image captions
Reported by: | dnusim | Owned by: | azaozz |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.9.2 |
Component: | TinyMCE | Keywords: | needs-patch gsoc |
Focuses: | Cc: |
Description
Basic HTML, like text links, should be allowed in image captions. Links are now stripped from the captions.
Text links in the image caption would be the most logical way to credit the photographer. In some cases, a link to the license covering the image is also mandatory. Creative Commons-licensed images are a great example of this.
Attachments (2)
Change History (19)
#3
@
15 years ago
- Component changed from Gallery to TinyMCE
- Milestone changed from Unassigned to Future Release
- Owner set to azaozz
#4
@
15 years ago
- Milestone changed from Future Release to 3.1
As it turns out: Links with singly-quoted attributes are only stripped if you are using the visual editor (in WP 2.9.2). If you are using the basic (HTML) editor, they are instead escaped before inserting them into the shortcode, which works fine.
I'm guessing a solution would involve doubly-quoted attributes being made singly-quoted before they are escaped, as I'm guessing the double quotes mess up the way shortcodes work. On top of that we need to figure out why the visual editor doesn't give the same result as the basic editor.
Changing milestone to 3.1 as this seems to affect a lot of people.
#7
@
14 years ago
This issue seems to be resolved in trunk. If someone will confirm, I think we can close this.
#8
@
14 years ago
Single quotes work in HTML mode. Double quotes in HTML mode (escaped or not) break the caption if caption="..." uses double quotes. Tags are stripped if you use the caption field in the Image GUI but the caption still works.
#9
@
14 years ago
- Milestone changed from Awaiting Triage to 3.1
I thought this was going to happen in 3.1 with the TinyMCE update. Moving there just because I think there might be a duplicate ticket or some code somewhere. Otherwise, punt.
#15
@
13 years ago
I'm not sure if this is perfect, but I think a step in the right direction here. This patch helps with adding links to captions in the visual editor mode.
The issue with links in the visual editor is that captions have all HTML entities filtered out of them. The patch filters out only non-anchor tags, leaving anchors there.
The other issue is the caption shortcode holds the text for caption between double quotes. To deal with this all quotes within the caption are converted to single quotes.
When you use the visual editor to add a link to the caption text it is stripped out when saving but you can edit the caption attribute in the HTML view and it will save.
I have found several people talking about it:
http://www.priceplow.com/wordpress-link-in-image-caption
http://www.transformationpowertools.com/wordpress/hyperlinks-in-wordpress-image-captions
http://blogwip.com/images/adding-linked-captions-images-wordpress/
Looking through the code and it appears to be the "wpeditimage" TinyMCE JavaScript plugin that is replacing all HTML tags in the contents of the caption attribute:
from /wp-includes/js/tinymce/wp-tinymce.php