{"id":10705509,"date":"2018-09-20T03:47:26","date_gmt":"2018-09-20T03:47:26","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/enqueue-scripts-styles-to-use-wp_plugin_url-instead-of-wp_content_dir-path\/"},"modified":"2018-09-20T09:27:32","modified_gmt":"2018-09-20T09:27:32","slug":"enqueue-scripts-styles-to-use-wp_plugin_url-instead-of-wp_content_dir-path","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/enqueue-scripts-styles-to-use-wp_plugin_url-instead-of-wp_content_dir-path\/","title":{"rendered":"enqueue scripts\/styles to use WP_PLUGIN_URL instead of WP_CONTENT_DIR path?"},"content":{"rendered":"<p>i am seeing 404 errors for js &amp; css files, with a custom setup, where the plugin directory doesn&#8217;t reside in the WP_CONTENT_DIR.<\/p>\n<p><strong>fs-core-functions.php<\/strong> [li 86-94]:<br \/>\nUsing the WP_CONTENT_DIR &amp;&amp; content_url(), <strong>fs_asset_url()<\/strong> fails to set the asset directories leaving the server file path within the url.<\/p>\n<blockquote><p>https:\/\/domain.dev\/&lt;content_urlpath&gt;\/&lt;file_dirpath_to_cpt-onomies_folder&gt;\/freemius\/assets\/css\/admin\/dialog-boxes.css\/<\/p><\/blockquote>\n<p>within the plugin&#8217;s \/config.php [li 108-119], i notice that each of the asset paths are assigned as directory paths instead of url paths.<\/p>\n<p>is it possible to either:<\/p>\n<ul>\n<li>use the WP_PLUGIN_URL constants to support custom folder structures: ex. where the WP_PLUGIN_URL is: https:\/\/domain.tld\/vendor <\/li>\n<\/ul>\n<p><strong>wp-config.php<\/strong><\/p>\n<pre><code>\/\/includes dirpath\ndefine( &#039;WP_PLUGIN_DIR&#039;, ABSPATH . &lt;custom_plugin_directory&gt; );\n\/\/accessible urlpath \ndefine( &#039;WP_PLUGIN_URL&#039;, WP_SITEURL . &#039;\/&#039; . &lt;custom_plugin_directory&gt; );<\/code><\/pre>\n<p><strong>OR<\/strong> <\/p>\n<ul>\n<li>update the directory paths to url paths CONSTANTS within the config.php for items accessed in the browser?<br \/>\n[ WP_FS__DIR_ASSETS, WP_FS__DIR_CSS, WP_FS__DIR_JS, WP_FS__DIR_IMG ]<\/li>\n<\/ul>\n<p>i see the WP_PLUGIN_URL constant used elsewhere in the plugin code. &amp; thought it may reduce function calls to ascertain enqueue urls for assets, &amp; allow for uncommon setups.<\/p>\n<p>????<\/p>\n<p>thanks<\/p>\n","protected":false},"template":"","class_list":["post-10705509","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10705509","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10705509\/revisions"}],"predecessor-version":[{"id":10705513,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10705509\/revisions\/10705513"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=10705509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}