Make WordPress Core

Opened 14 months ago

Closed 14 months ago

Last modified 14 months ago

#23502 closed defect (bug) (duplicate)

wp_register_script results in the appearance of & HTML entity

Reported by: computerslayer1 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:


When using the wp_register_script function in the functions.php file to override the jquery.js script, the HTML erroneously converts the ampersand for the cache busting query string into the HTML entity.

 * Override jquery
function mytheme_init(){
	if ( !is_admin() ){
		wp_register_script('jquery', get_template_directory_uri().'/js/jquery.js?183', array(), '1');
add_action('init', 'mytheme_init');

When wp_head() is in the header.php file, it results in this HTML:

<script type='text/javascript' src='http://ymca.saratogaregionalymca.org/content/themes/mytheme/js/jquery.js?183&#038;ver=1'></script>

This appears to be an old bug, as there is a forum thread over a year old about the issue: http://wordpress.org/support/topic/wp_register_script-char-is-converted-to?replies=2

Change History (4)

comment:1 ocean9014 months ago

  • Keywords close added; needs-patch needs-testing removed

comment:2 SergeyBiryukov14 months ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #9243.

comment:3 SergeyBiryukov14 months ago

  • Version 3.5.1 deleted

comment:4 TobiasBg14 months ago

On a side note: And please, please, please, please, please don't override jQuery with your own version! This is basically never necessary! And you will easily break other plugins's JS code.

Note: See TracTickets for help on using tickets.