[wp-trac] [WordPress Trac] #40771: Unable to add YouTube video to Video Widget
WordPress Trac
noreply at wordpress.org
Tue May 16 19:23:39 UTC 2017
#40771: Unable to add YouTube video to Video Widget
--------------------------+--------------------------
Reporter: taijacg | Owner: westonruter
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 4.8
Component: Widgets | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+--------------------------
Comment (by jnylen0):
I am -1 on the proposed solution for the URL here (modifying the return
value of `rest_url` with a regex) for several reasons.
First, this is the first usage of the REST API in the admin and having the
standard function for this fail right off the bat and having to hack
around it with a regex is not a great example, this worries me a bit.
Second, and more specifically, it's possible to have all kinds of exotic
configurations where wp-admin URLs are different from the URLs of other
parts of WP, including the API. These can be different hostnames and
protocols, like they are on WP.com. Undoubtedly other multisite
installations have done similar things.
If we really do need separate behavior for getting a REST URL in the admin
context, then it needs to live in a new, reusable function like
`wp_admin_rest_url`. However, we should try pretty hard to avoid this by
just making `rest_url()` work correctly. For example, we could change the
API protocol to HTTPS if the current page is served over HTTPS
(`is_ssl()`) ''and'' the REST API is served over HTTP (`wp_startswith(
strolower( rest_url( ... ) ), 'http:' )`).
See #34299 which does something similar. I'm not sure why that logic
wouldn't be kicking in here.
See also #36451 which looks like the same underlying issue to me.
cc @johnbillion @rmccue who have looked at such issues in the past.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40771#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list