[wp-trac] [WordPress Trac] #46981: Bundled themes should pass version to wp_enqueue_script() to ensure proper cache busting
WordPress Trac
noreply at wordpress.org
Wed May 8 16:21:30 UTC 2019
#46981: Bundled themes should pass version to wp_enqueue_script() to ensure proper
cache busting
---------------------------+-----------------------
Reporter: dswebsme | Owner: dswebsme
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 5.2.1
Component: Bundled Theme | Version: 5.1.1
Severity: minor | Resolution:
Keywords: needs-patch | Focuses:
---------------------------+-----------------------
Comment (by justinahinon):
Oh ok. Got it. Thanks.
It's weird, but when I look into a twenty nineteen functions.php, I can't
find where
{{{
wp_get_theme()->get( 'Version' )
}}}
is used for wp_enqueue_script.
Here's what I have on my side
{{{
/**
* Enqueue scripts and styles.
*/
function twentynineteen_scripts() {
wp_enqueue_style( 'twentynineteen-style', get_stylesheet_uri(),
array(), wp_get_theme()->get( 'Version' ) );
wp_style_add_data( 'twentynineteen-style', 'rtl', 'replace' );
if ( has_nav_menu( 'menu-1' ) ) {
wp_enqueue_script( 'twentynineteen-priority-menu',
get_theme_file_uri( '/js/priority-menu.js' ), array(), '1.1', true );
wp_enqueue_script( 'twentynineteen-touch-navigation',
get_theme_file_uri( '/js/touch-keyboard-navigation.js' ), array(), '1.1',
true );
}
wp_enqueue_style( 'twentynineteen-print-style',
get_template_directory_uri() . '/print.css', array(), wp_get_theme()->get(
'Version' ), 'print' );
if ( is_singular() && comments_open() && get_option(
'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'twentynineteen_scripts' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46981#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list