Make WordPress Core

Opened 8 months ago

#59539 assigned defect (bug)

wp_register_style and wp_register_script adds ver incorrectly

Reported by: forcesail's profile forcesail Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version: 6.3.1
Component: Script Loader Keywords:
Focuses: Cc:

Description

Hello,

I'm sorry to report but it seems that function wp_enqueue_style adds ver incorrectly in case of existence some url parameters in src.

For example:

Style example:

<?php
add_action( 'wp_enqueue_scripts', function() {
wp_enqueue_style( 'my-custom-font', 'https://fonts.googleapis.com/css?family=Roboto+Condensed');
});

adds:

<link rel='stylesheet' id='my-custom-font-css' href='https://fonts.googleapis.com/css?family=Roboto+Condensed&#038;ver=6.3.1' type='text/css' media='all' />

(you see '&#038;' instead of just '&')

Script example (from contact-form-7):

<?php
wp_register_script( 'google-recaptcha',
    add_query_arg(
        array(
            'render' => $service->get_sitekey(),
        ),
        $url
    ),
    array(),
    '3.0',
    true
);

adds:

<script type='text/javascript' src='https://www.google.com/recaptcha/api.js?render=6LfrGhQlAAAAAD6sCXSbihhcAwBHfR25-huvzmtQ&#038;ver=3.0' id='google-recaptcha-js'></script>

(again, you see ‘&#038;‘ instead of just ‘&’)

You can find these issues on: https://forcesail.ru/

Change History (0)

Note: See TracTickets for help on using tickets.