Make WordPress Core

Opened 14 years ago

Closed 12 years ago

Last modified 6 years ago

#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)

21969.patch (815 bytes ) - added by SergeyBiryukov 14 years ago.
21969.diff (537 bytes ) - added by kovshenin 12 years ago.

Download all attachments as: .zip

Change History (11)

#1 @SergeyBiryukov
14 years ago

  • Keywords has-patch added

Related: ticket:21749:2

get_*_directory_uri() should probably return encoded results, like their WP_Theme counterparts.

#2 @SergeyBiryukov
14 years ago

  • Version trunk3.4

#3 @ocean90
13 years ago

  • Keywords commit added
  • Milestone Awaiting Review3.9

#4 @nacin
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 @azizur
13 years ago

  • Keywords needs-unit-tests removed

Looks like ticket #21749 has got unit tests to cover this scenario.

#6 @nacin
12 years ago

  • Owner set to nacin
  • Resolutionfixed
  • Status newclosed

In 27710:

Encode spaces in get_template_directory_uri() and get_stylesheet_directory_uri().

props SergeyBiryukov.
fixes #21969.

@kovshenin
12 years ago

#7 @kovshenin
12 years ago

  • Keywords commit removed
  • Resolution fixed
  • Status closedreopened

r27710 broke some unit tests:

  • Tests_XMLRPC_wp_getOptions::test_option_values_subscriber
  • Tests_XMLRPC_wp_getOptions::test_option_values_admin

See 21969.diff.

#8 @SergeyBiryukov
12 years ago

  • Resolutionfixed
  • Status reopenedclosed

In 27915:

Fix copy/paste error in [27710].

props kovshenin.
fixes #21969.

This ticket was mentioned in Slack in #core by sergey. View the logs.


6 years ago

Note: See TracTickets for help on using tickets.