[wp-trac] [WordPress Trac] #33386: Media GUID should never be treated as the filename or URL
WordPress Trac
noreply at wordpress.org
Mon Aug 17 06:25:37 UTC 2015
#33386: Media GUID should never be treated as the filename or URL
--------------------------+-----------------------------
Reporter: rmccue | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
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:
1. 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.
2. 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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33386>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list