Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#7370 closed defect (bug) (invalid)

Some hyperlinks are broken by saving the post

Reported by: vladsharp Owned by:
Milestone: Priority: high
Severity: critical Version: 2.6
Component: General Keywords: links, visual editor
Focuses: Cc:


When adding a link to a post, sometimes the link is shown incorrectly in the editor (after a save). Wordpress 2.6, with plugins installed (Akismet, Easy Tube, flickrRSS, Flutter, Most Commented, Popularity Contest) and the default (Kubrick) theme.

Here are the different cases tried:

  1. In HTML editor mode (Visual Editor enabled in settings though):
    1. Input:
      <a href="http://google.com">test</a>
      works as expected.
    2. Input:
      <a href="http://google.com" target="_blank">test</a>
      yields the following (after saving):
      <a href="http://google.com">test</a>
      i.e. the target is ignored.
  1. Input:
    <a href="http://google.com" title="Hello" target="_blank">test</a>
    yields the following:
    <a href="http://google.com" title="Hello">test</a>
    and saving again does not change anything. (the target is ignored again)
  2. Input:
    <a href="http://google.com" title="Other">test</a>
    works as expected.
  1. In Visual editor mode:
    1. Input: Type in the text "Google", select it with the mouse, add a new hyperlink, only using the field for the actual link. Saving the post leads to correct behaviour.
    2. Input: As step 2.a. but also and set the link's target - target is ignored upon save (as expected).
    3. Input: As step 2.a. but also add a title to the link ("Hello") - title is correctly updated.

So far, so good. The only thing not working is the target="" for <a> tags.

  1. Create a new post in the Visual Editor (to make things simple):
    1. Input: Type
      test Google test
      then select the text Google, make it into a link, and add a new window target as well as the title "Something hello". The result after saving the post is (viewing the HTML):
      test <a title="Google something" href="&lt;br"></a> "http://www.google.com"&gt;Google test

It appears in this case, the tag was somehow confused by the POST handler for the saving of the post, and it decided to quote certain things. (My usage of POST is the HTTP POST). (As per usual, the target is being ignored here).

Not sure where this is going wrong, but this should definitely be fixed in 2.6.1 (upon verification).

Change History (3)

#1 @vladsharp
10 years ago

Apologies for the formatting of point 3. - here it is again:

  1. Create a new post in the Visual Editor (to make things simple):
    1. Type
      test Google test
      into the visual editor box, then select the text "Google", make it into a link - with a title "Google something" and a 'new window' target. The result after saving the post is:
      test <a title="Google something" href="&lt;br"></a> "http://www.google.com"&gt;Google test

verified by looking at the HTML of the preview page.

  1. If the same is done, but without saving the post, then the followin appears in the HTML editor:
    test <a title="Google something" href="http://google.com" target="_blank">Google</a> test
    which is correct!

#2 @azaozz
10 years ago

  • Milestone 2.6.1 deleted
  • Resolution set to invalid
  • Status changed from new to closed

Cannot reproduce this. All links, with or without target attribute work well. Tested while logged in as admin and as contributor. Could it be one of the plugins? Are there any similar problems reported on the support forum?

Closing as invalid for now.

#3 @vladsharp
10 years ago

The error originates somewhere in the HTMLPurifier component of the Flutter plugin. I'll contact the author, try to get it resolved. For now, I've disabled that component and it works great.

Note: See TracTickets for help on using tickets.