From 045a8ef0bb7ceab554aedfa66d769eba6bd4fac7 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Thu, 11 Jan 2024 21:02:25 +0100 Subject: [PATCH] Call wp_print_scripts action to include all scripts (#34) * Call wp_print_scripts action to include all scripts * Update branch alias --- composer.json | 2 +- h2push.php | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 0f47b71..304bc13 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ }, "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.2-dev" } }, "minimum-stability": "dev", diff --git a/h2push.php b/h2push.php index 810937e..53be509 100644 --- a/h2push.php +++ b/h2push.php @@ -3,7 +3,7 @@ * Plugin Name: HTTP/2 Server Push * Plugin URI: https://github.com/wearerequired/h2push/ * Description: Sends Link headers to bring HTTP/2 Server Push for scripts and styles to WordPress. - * Version: 2.2.0 + * Version: 2.2.1-beta * Requires at least: 5.6 * Requires PHP: 7.4 * Author: required @@ -11,7 +11,7 @@ * License: GPL-2.0+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt * - * Copyright (c) 2017-2022 required (email: info@required.ch) + * Copyright (c) 2017-2024 required (email: info@required.ch) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2 or, at @@ -230,6 +230,15 @@ function get_push_resources(): array { } // Scripts. + + // Core and plugins may add more dependencies during `wp_print_scripts`. + // Example: wp-interactivity for blocks. + if ( ! did_action( 'wp_print_scripts' ) ) { + ob_start(); + do_action( 'wp_print_scripts' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound + ob_end_clean(); + } + $wp_scripts = wp_scripts(); $wp_scripts->all_deps( $wp_scripts->queue ); $files = $wp_scripts->to_do;