#33386 closed defect (bug) (fixed)
Media GUID should never be treated as the filename or URL
Reported by: | rmccue | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description
Right now, there's a bunch of code in core (especially around display) that assumes a media item (attachment
post) has a GUID which points to the URL. One instance of this was fixed in #32531, but others still exist.
This is problematic in at least two circumstances I can think of:
- If you change GUIDs to be a different system than just the permalink, this breaks media. For example, using UUIDs instead will give things like
urn:uuid:f468f435-80bd-4709-bb52-f5c3e782a2ac
in your media library. - If you import media from another site, the filename may change, and the URL almost certainly will. Right now, the importer updates the GUID, which is a pretty big no-no. This has the potential to break all sorts of things.
These should be switched from $attachment->guid
to get_attached_file( $attachment->ID )
instead.
Attachments (2)
Change History (8)
Note: See
TracTickets for help on using
tickets.
#33872 was marked as a duplicate.