#21969 closed defect (bug) (fixed)
Wrong URL in wp_enqueue_script()
| Reported by: | pavelevap | Owned by: | nacin |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.9 |
| Component: | Themes | Version: | 3.4 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
This problem is probably related to fixed ticket #21749
Example theme directory
wp-content/themes/Some Theme/Theme
I noticed it with one premium theme. Users usually upload downloaded files through FTP with one more parent directory.
Function get_template_directory_uri() returns right URL:
wp-content/themes/Some Theme/Theme
But using it with wp_enqueue_script():
wp_enqueue_script( 'maxheight', get_template_directory_uri() . '/js/maxheight.js' );
it returns wrong URL:
wp-content/themes/SomeTheme/Theme/js/maxheight.js
And script is not loaded in the end (Not Found error).
Reproduced on current trunk and 3.4.x.
Attachments (2)
Change History (11)
#4
@
13 years ago
- Keywords needs-unit-tests added
I'm good with this. Let's just get some unit tests. It should be possible to filter the stylesheet values and then call the function.
#5
@
13 years ago
- Keywords needs-unit-tests removed
Looks like ticket #21749 has got unit tests to cover this scenario.
#7
@
12 years ago
- Keywords commit removed
- Resolution fixed
- Status closed → reopened
r27710 broke some unit tests:
- Tests_XMLRPC_wp_getOptions::test_option_values_subscriber
- Tests_XMLRPC_wp_getOptions::test_option_values_admin
See 21969.diff.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Related: ticket:21749:2
get_*_directory_uri()should probably return encoded results, like their WP_Theme counterparts.