Use of WP_PLUGIN_URL blocks HTTPS requests

  • Posts: 1

Use of WP_PLUGIN_URL blocks HTTPS requests was created by mariondorsett

The problem:
Assets from the Yendif Player plugin are blocked when the WP site URL uses HTTP and the request to the page is made using HTTPS.

The Cause:
WP core doesn't check the request scheme used by the browser and simply returns the value of get_option('siteurl') to be used as is by the WP_CONTENT_URL constant.

The Yendif Player plugin uses the WP constant WP_PLUGIN_URL to resolve it's assets URLs, however, the WP_PLUGIN_URL is based on the WP_CONTENT_URL, and when it hold the unsecure http:// scheme and the page request is secure using https://, the Yendif Player assets don't get loaded by browser security restrictions blocking the unsecured content.

The solution:
I would recommend removing the requested scheme from the WP_PLUGIN_URL so the assets are loaded based on the current request scheme.

define( 'YENDIF_PLAYER_PLUGIN_URL', str_replace(array('http:', 'https:', '', WP_PLUGIN_URL) . '/' . YENDIF_PLAYER_PLUGIN_NAME );

Then the plugin assets would be loaded from:
//domain.tld/wp-content/plugins/yendif-player/......

... and the browser will load the assets using the same scheme as the request.
The following user(s) said Thank You: Administrator
6 years 3 weeks ago #1869

Please Log in or Create an account to join the conversation.

Replied by Administrator on topic Use of WP_PLUGIN_URL blocks HTTPS requests

Thanks for sharing the solution :) I'm very grateful to you :):)
6 years 3 weeks ago #1870

Please Log in or Create an account to join the conversation.

Time to create page: 0.088 seconds

Business Address

PLUGINSWARE INTERACTIVE PVT LTD
Door No 2A, Venkateshwara Nagar,
1st Main Road, Velachery, Chennai,
Tamilnadu, India
Pincode: 600042
© 2013 - 2024 Pluginsware Interactive Private Limited. All Rights Reserved. The Joomla! name and logo is used under a limited license granted in the United States and other countries.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.