{"id":1187471,"date":"2016-11-03T18:21:28","date_gmt":"2016-11-04T01:21:28","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/"},"modified":"2016-11-03T18:24:18","modified_gmt":"2016-11-04T01:24:18","slug":"use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/","title":{"rendered":"Use of WP_CONTENT_URL breaks plugin on admin SSL only sites"},"content":{"rendered":"<p>This is actually a problem with the free plugin, not with the pro plugin. I posted on the wordpress.org forum, but wanted to post here as well. <\/p>\n<p>I see this is somewhat of a known issue, but figure that my troubleshooting might help in a more expedient fix. <\/p>\n<p>In the recent releases, you&#8217;ve begun using WP_CONTENT_URL in determining resource URLs and paths. This causes a number of issues on sites that use FORCE_SSL_ADMIN, but have non-ssl on the front-end. <\/p>\n<p>First it causes about 14 different styles\/scripts to fail to load on the admin because of mixed content. It tries to load them via http, while the admin uses https. The problem is in the function <em>tribe_resource_url()<\/em>, however this is easy to workaround by just hooking the filter &#8220;tribe_resource_url&#8221;. <\/p>\n<p>However, the bigger problem is in the <em>Tribe__Assets<\/em> class. The <em>maybe_get_min_file()<\/em> function uses this constant as well. It uses it to try to convert the supplied URL to a file path, but ends up failing because it&#8217;s trying to do a <em>str_replace()<\/em> on an http URL, but we&#8217;re supplying an https because of the filter we used to fix bug above, so it can&#8217;t find the substring to replace. This forces a URL to be supplied to <em>file_exists()<\/em> instead of a path, which makes it fail. All of that cascades into causing a <em>return false<\/em>. So when <em>Tribe__Assets-&gt;register()<\/em> attempts to find use minified file, it instead sets the URL to false preventing them from loading at all. <\/p>\n<p>Then since they don&#8217;t load, the JS errors out when events-admin.js tries to call <em>bumpdown()<\/em>, thus rendering all JS on the Events pages of the admin broken. <\/p>\n<p>I see no way to fix this for my setup without forking the plugin. Or perhaps you can make those functions (<em>maybe_get_min_file()<\/em> and <em>tribe_resource_url()<\/em>) be protocol relative? An even easier workaround would be to just simply use <em>plugins_url()<\/em> or <em>content_url()<\/em>. This is exactly the scenario those functions exist for, as they will use the proper protocol. The codex even says those constants are not to be used by plugins.<br \/>\nSee: https:\/\/codex.wordpress.org\/Determining_Plugin_and_Content_Directories#Constants<\/p>\n","protected":false},"template":"","class_list":["post-1187471","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Use of WP_CONTENT_URL breaks plugin on admin SSL only sites -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Use of WP_CONTENT_URL breaks plugin on admin SSL only sites -\" \/>\n<meta property=\"og:description\" content=\"This is actually a problem with the free plugin, not with the pro plugin. I posted on the wordpress.org forum, but wanted to post here as well. I see this is somewhat of a known issue, but figure that my troubleshooting might help in a more expedient fix. In the recent releases, you&#8217;ve begun using [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/\" \/>\n<meta property=\"article:modified_time\" content=\"2016-11-04T01:24:18+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/\",\"name\":\"Use of WP_CONTENT_URL breaks plugin on admin SSL only sites -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-11-04T01:21:28+00:00\",\"dateModified\":\"2016-11-04T01:24:18+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Use of WP_CONTENT_URL breaks plugin on admin SSL only sites\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Use of WP_CONTENT_URL breaks plugin on admin SSL only sites -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/","og_locale":"en_US","og_type":"article","og_title":"Use of WP_CONTENT_URL breaks plugin on admin SSL only sites -","og_description":"This is actually a problem with the free plugin, not with the pro plugin. I posted on the wordpress.org forum, but wanted to post here as well. I see this is somewhat of a known issue, but figure that my troubleshooting might help in a more expedient fix. In the recent releases, you&#8217;ve begun using [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/","article_modified_time":"2016-11-04T01:24:18+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/","name":"Use of WP_CONTENT_URL breaks plugin on admin SSL only sites -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-11-04T01:21:28+00:00","dateModified":"2016-11-04T01:24:18+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/use-of-wp_content_url-breaks-plugin-on-admin-ssl-only-sites\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"Use of WP_CONTENT_URL breaks plugin on admin SSL only sites"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1187471","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1187471\/revisions"}],"predecessor-version":[{"id":1187472,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1187471\/revisions\/1187472"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1187471"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}