Opened 19 years ago
Closed 9 years ago
#1914 closed enhancement (fixed)
Permalinks for unattached uploads/attachments
Reported by: | Owned by: | pento | |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 1.6 |
Component: | Permalinks | Keywords: | has-patch needs-unit-tests |
Focuses: | Cc: |
Description
Currently attachement links are in the form:
http://www.example.com/?attachment_id=1
Would look much neater if these matched the permalinks of regular posts (depending on what it is configured to) eg:
http://www.example.com/attachement/1/
Attachments (4)
Change History (27)
#3
@
13 years ago
- Component changed from Administration to Permalinks
- Keywords needs-patch added
- Milestone set to Future Release
- Resolution wontfix deleted
- Status changed from closed to reopened
- Summary changed from Attachement Permalinks to Permalinks for unattached uploads/attachments
- Type changed from defect (bug) to enhancement
Re-opening this guy.
If media is uploaded using Media -> Add New, it doesn't get a permalink because it doesn't have a post.
I'd like to suggest the idea proposed in the original post be reconsidered. Query strings are ugly. :)
#6
@
12 years ago
Currently http://example.com/attachment-slug-name/ will work for Attachments not attached to any posts, but we don't generate links using that format.
#7
@
11 years ago
Attached a patch here to enable this functionality. I'd love to get this request closed up since it's the oldest ticket in trac.
#9
follow-up:
↓ 11
@
10 years ago
- Keywords 2nd-opinion dev-feedback added
Rather shame to see this as "won't fix". It just shows your general attitude to understanding of what permanent (and pretty) URLs should look like for the whole Wordpress, not just part of it, because some of the attachments are "orphans".
BTW, as a temporary fix I have reattached these orphans to the parent posts, so Wordpress now actually works instead of showing ugly URLs.
If prepending general "attachment/" part is not the solution to this and you don't offer any other suggestions than nothing is. I find the developers in this thread somehow pathetic in their stance towards this simple (and moreover logical - permalinks structure is set up after all!) request.
BTW, easy patch to fix this was uploaded exactly 12 months ago and nobody paid attention. That says something, doesn't it?
#10
@
10 years ago
Per comment:8, we should probably just leverage the existing format in get_attachment_link()
instead of introducing new rewrite rules.
#11
in reply to:
↑ 9
@
10 years ago
- Keywords has-patch added; needs-patch 2nd-opinion removed
Replying to keketovic:
Rather shame to see this as "won't fix".
I find the developers in this thread somehow pathetic in their stance towards this simple (and moreover logical - permalinks structure is set up after all!) request.
This ticket is open. A lot of things change in 9 years. Let's all stay away from attacks, please.
We de-emphasize the attachment relationship in some ways now. I would agree that this is worth revisiting in that light. "Attachment" doesn't really seem like the right way to refer to a media item when it's not attached, though. We don't call it the "Attachment Library".
#13
@
10 years ago
I applied the two patches.
For the obvious case to query a single attachment page it works fine.
Are there special cases that I can test?
#14
in reply to:
↑ 12
@
10 years ago
- Keywords needs-testing added
Replying to SergeyBiryukov:
1914.diff implements comment:10.
I tested all the changes from this patch (not including my patch for added rewrite rules) and it looks good.
I tested a number of different permalink settings. I think this is ready to go.
#16
@
9 years ago
- Keywords needs-unit-tests added; dev-feedback needs-testing removed
- Milestone changed from Future Release to 4.4
#17
@
9 years ago
- Keywords needs-refresh added
1914.diff only solves half of the problems:
- The ugly permalink is still shown at some places, like in the media list table and when editing the media item
- Doesn't work in every scenario. For example, when a media item is attached to some post that is from an old post type (not registered anymore, just lying in the database), the ugly permalink is used. There's no redirect to the pretty permalink.
#19
@
9 years ago
1914.3.diff resets some flags after posts are queried to break the collision with pages, makes unit tests pass
Attachment permalinks are in the form [parent permalink]/[attachment slug]. There is not an intermediate attachment permalink style. What is an attachment without something to attach to?
It has not been decided what to do with orphaned attachments, although I think we should drop and unlink.