Make WordPress Core

Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#22679 closed enhancement (wontfix)

Ensure that inserted images linked to the attachment page get correct permalink format

Reported by: jond3r's profile jond3r Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords: has-patch
Focuses: Cc:

Description

When inserting an unattached image (with no parent) from the media library and setting the "Link To" option to "Attachment page", the URL at first gets the default query string format (with a '?'). Though after updating the post it gets the final "pretty" format (which seems to happen in the function _fix_attachment_links() in wp-admin/includes/post.php).
The provided patch, gives the URL the final pretty format directly.
See also #22085.

Attachments (2)

22679.diff (1.3 KB) - added by jond3r 12 years ago.
22679-2.diff (1.4 KB) - added by jond3r 11 years ago.

Download all attachments as: .zip

Change History (9)

@jond3r
12 years ago

#1 @miqrogroove
12 years ago

Is this a trunk issue though?

In 3.4.2, if I add an unattached image to a draft and then publish it, I get the behavior your described. If I add an unattached image to a previously published post, then the attachment URL never gets "pretty".

In 3.5, the attachment URL always becomes "pretty" after updating the post.

#2 @nacin
12 years ago

Yeah, this looks like it would solve itself after updating the post a second time (i.e. to save what you've inserted). Not saying this isn't a good fix, but would rather avoid redundant/in-depth measures at this point in the release cycle.

#3 follow-up: @jond3r
12 years ago

Ok. Actually at first I didn't realize that the link was fixed when updating. But then I had already written a fix, so I thought I might submit it anyway. After all this was my first try, so maybe I'll be more lucky next time. I might submit another media bug tomorrow, if it's not spotted by then.

#4 in reply to: ↑ 3 @nacin
12 years ago

Replying to jond3r:

I might submit another media bug tomorrow, if it's not spotted by then.

jond3r: We plan to do a final code freeze for 3.5 as early as tomorrow, so the earliest you can submit that, the better!

I appreciate the fix here. It's valid, it just needs a lot of testing and can happen in 3.6.

@jond3r
11 years ago

#5 @jond3r
11 years ago

  • Summary changed from Ensure that unattached images inserted from media library get pretty url directly to Ensure that inserted images linked to the attachment page get correct permalink format

22679-2.diff is a refresh that adds checks that default permalinks are not used and that the post is not a draft or pending before calling get_attachment_link().

Even though the proposed change does not improve the final content of published posts, it adds transparency to the process of obtaining attachment links, instead of relying on _fix_attachment_links() to step in when the post is updated.

Also as long as #25268 is not fixed, the proposed change will improve the final appearance of attachment links added to private and scheduled posts, see #25268 for details.

Note that attachment links added to drafts still have to rely on _fix_attachment_links() to get their final format. This obviously lessens the value of the proposed change.

#6 @jond3r
11 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

Now that #25268 got fixed, the relevance of this proposal has further diminished.
Let's move on and find something more urgent to improve.

#7 @DrewAPicture
11 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.