[wp-trac] [WordPress Trac] #32112: wp_get_attachment_url returns https when it should not
WordPress Trac
noreply at wordpress.org
Wed Apr 29 15:50:01 UTC 2015
#32112: wp_get_attachment_url returns https when it should not
-------------------------------------+---------------------------
Reporter: zabatonni | Owner: boonebgorges
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 4.2.2
Component: Media | Version: 4.2
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+---------------------------
Comment (by khlo):
Thanks @boonebgorges - will also test the updated version of the patch
later in production.
Agreed about the comments using the same function for context-sensitive
and non-context-sensitive stuff. The only thing that concerns me a bit
about this pull request is it almost feels like the wrong place to fix it.
Firstly, because we add context-sensitivity in `wp_get_attachment_url()`
and then we get rid of it again in `wp_ajax_query_attachments()`.
Secondly, it seems a little difficult to maintain. Do we have any other
non-contextual business functions that also depend on
`wp_get_attachment_url()`? There's also something like the Admin Media
Library. Presumably this should also show canonical URLs for the sake of
consistency (but it probably has little impact there).
Finally, I wonder if there are any third-party plugins that depend on
`wp_get_attachment_url()` to return a canonical URL (not sure if they'll
be using `wp_ajax_query_attachments()` to insert the image).
As a total newbie (so please feel free to shoot me down!), it almost seems
to make more sense to have `wp_get_attachment_url()` always return the
canonical URL. We should then have an output filter which changes the
scheme in the output as necessary (it seems to be a more logical place to
put context-sensitive code). Finally, it might be possible to implement
protocol-relative URLs as a filter on the content whilst leaving the
canonical URLs in the original, unfiltered content (e.g. for e-mail
subscription plugins, RSS output, direct database queries, etc).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32112#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list