#21969 closed defect (bug) (fixed)
Wrong URL in wp_enqueue_script()
Reported by: | pavelevap | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.9 | Priority: | normal |
Severity: | normal | Version: | 3.4 |
Component: | Themes | Keywords: | has-patch |
Focuses: | Cc: |
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
@
11 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
@
11 years ago
- Keywords needs-unit-tests removed
Looks like ticket #21749 has got unit tests to cover this scenario.
#6
@
11 years ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In 27710:
#7
@
11 years ago
- Keywords commit removed
- Resolution fixed deleted
- Status changed from closed to 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.
Related: ticket:21749:2
get_*_directory_uri()
should probably return encoded results, like their WP_Theme counterparts.