-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect asset enqueuing if plugin_url() is relative #655
Comments
Hi Kenneth, Can you give a bit more details, a file/line number, and what you expect to be output and what is actually output? Thanks, Stiofan |
Hi Stiofan, I'm sorry, I made a typo. It shoulde be plugins_url(). It's line 1342 starting the method. The output ($url variable) should be the complete URL to the current folder, however if plugins_url() is a relative path, $url_parts[0] will end up being "", for which !empty($url_parts[0]) returns false. This results in the $url being returned being just an empty string ("") and thus assets being wrong enqueued. |
i have never seen this as a relative path, i guess you are filtering it for some reason? |
Hi Stiofan, We have a custom folder structure for all client sites. We use /assets/plugins instead of {domain}/wp-content/plugins. We set this in the wp-config.php file. |
ok i guess you are setting the constant "WP_PLUGIN_URL", that is supposed to be a full URL, is there a reason not to use the full url? |
Ah I see, I think the issue is in the WP_CONTENT_URL, which is defined relative to the domain (starting with a slash), as we use the same wp_config.php for all client sites (DB settings and Auth Keys excluded). The issue is that we do not have access to get_option('site_url') in the wp-config.php. For this reason we have to make the WP_CONTENT_URL relative. |
how many sites are we talking? |
Roughly 50 sites, however only one is using this plug-in at the moment. |
What about adding a check then?
I'm hesitant to add our own checks for this as that constant should always be a full URL |
Hi,
I noticed that the form builder didn't work correctly ( I couldn't change the form options after creation). After a little bit of digging I noticed this issue was due to the get_url() method of the AyeCode_UI_Settings class not returning the correct value if the plugin_url() returned a relative path (relative to the domain).
To fix this issue I propose to add the following code to the get_url() method:
if(empty($url_parts[0]) && !empty($dir_parts[1])){ $url = trailingslashit( "/$wp_content_folder_name/".$dir_parts[1] ); }
This will fix the issue.
Kind regards,
Kenneth
The text was updated successfully, but these errors were encountered: