/** * Remove IE 'conditional' data from registered scripts/styles to avoid * WP 6.9 deprecation notice about WP_Dependencies->add_data( ..., 'conditional', ... ) * * Put this in functions.php or as a mu-plugin (recommended: mu-plugin). */ add_action( 'plugins_loaded', 'mp_remove_ie_conditional_data', 20 ); function mp_remove_ie_conditional_data() { // Only run when WP Scripts/Styles are available. if ( ! function_exists( 'wp_scripts' ) || ! function_exists( 'wp_styles' ) ) { return; } global $wp_scripts, $wp_styles; // Helper to remove 'conditional' keys if present (handles different container properties) $remove_conditional = function( $container ) { if ( ! is_object( $container ) || empty( $container->registered ) ) { return; } foreach ( $container->registered as $handle => $obj ) { // WP stores extra data either in 'extra' or 'data' arrays depending on WP version if ( isset( $obj->extra ) && is_array( $obj->extra ) && isset( $obj->extra['conditional'] ) ) { unset( $container->registered[ $handle ]->extra['conditional'] ); } if ( isset( $obj->data ) && is_array( $obj->data ) && isset( $obj->data['conditional'] ) ) { unset( $container->registered[ $handle ]->data['conditional'] ); } // older code may have stored it directly on the object if ( property_exists( $obj, 'conditional' ) && ! empty( $obj->conditional ) ) { unset( $container->registered[ $handle ]->conditional ); } } }; // Remove conditional from scripts and styles $remove_conditional( $wp_scripts ); $remove_conditional( $wp_styles ); }