From 8696eb170f4dd5d7d47259aff3839c31587af352 Mon Sep 17 00:00:00 2001 From: Jenisha Munikar Date: Tue, 4 Aug 2026 14:25:45 +0545 Subject: [PATCH] fix: deprecated wp_script_add_data() conditional notice on wp 6.9+ Only add the 'conditional' script data for html5shiv on WP < 6.9, since core dropped IE conditional comment output in 6.9 and the argument is deprecated there. --- inc/functions.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index f0e5f66..608aad0 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -115,7 +115,12 @@ function accelerate_scripts_styles_method() { // wp_enqueue_style( 'accelerate-fontawesome', get_template_directory_uri() . '/fontawesome/css/font-awesome.css', array(), '4.7.0' ); wp_enqueue_script( 'html5shiv', ACCELERATE_JS_URL . '/html5shiv.js', array(), '3.7.3', false ); - wp_script_add_data( 'html5shiv', 'conditional', 'lte IE 8' ); + + // The 'conditional' data key is deprecated since WP 6.9.0 and has no effect there; + // only set it on older versions to keep html5shiv restricted to IE8 and below. + if ( version_compare( $GLOBALS['wp_version'], '6.9', '<' ) ) { + wp_script_add_data( 'html5shiv', 'conditional', 'lte IE 8' ); + } } function accelerate_block_editor_styles() {