Plugins: Load wp-admin/includes/plugin.php earlier.

Partially reverts [59479] and [59461], which previously tried to move some functions from `wp-admin/includes/plugin.php` to `wp-includes/functions.php` so they are available early, so that `get_plugin_data()` can be used.

However, other functions from that file are often used by plugins without necessarily checking whether they are available, easily causing fatal errors. Requiring this file directly is a safer approach to avoid such errors.

Props peterwilsoncc, dd32, swissspidy, johnbillion.
Fixes #62244.
Built from https://develop.svn.wordpress.org/trunk@59488


git-svn-id: http://core.svn.wordpress.org/trunk@58874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler
2024-12-05 12:13:17 +00:00
parent 9c031458c8
commit cbca77642b
4 changed files with 310 additions and 307 deletions
+3
View File
@@ -518,6 +518,9 @@ if ( ! is_multisite() && wp_is_fatal_error_handler_enabled() ) {
wp_recovery_mode()->initialize();
}
// To make get_plugin_data() available in a way that's compatible with plugins also loading this file, see #62244.
require_once ABSPATH . 'wp-admin/includes/plugin.php';
// Load active plugins.
foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
wp_register_plugin_realpath( $plugin );