diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php index 31f82524bab85..4cd2b4467c001 100644 --- a/src/wp-includes/load.php +++ b/src/wp-includes/load.php @@ -831,6 +831,10 @@ function wp_using_ext_object_cache( $using = null ) { * Runs once, before must-use plugins load, so that every interface a drop-in's * classes implement already exists and every plugin sees the drop-in's provider. * + * The drop-in sets its overrides in the `$wp_secrets_provider`, `$wp_secrets_store` + * and `$wp_secrets_keyring` globals. They are declared global before the require, so + * a plain assignment such as `$wp_secrets_keyring = new My_Keyring();` works. + * * Sets `$GLOBALS['wp_secrets_dropin_loaded']` as soon as the file is found, whether * or not it then loads cleanly: wp_using_secrets_dropin() reports presence, not * health. @@ -873,6 +877,12 @@ function wp_load_secrets_dropin(): void { $GLOBALS['wp_secrets_dropin_loaded'] = true; + /* + * The drop-in is required inside this function. Declaring the overrides global + * lets it set them as plain variables, as db.php does with $wpdb. + */ + global $wp_secrets_provider, $wp_secrets_store, $wp_secrets_keyring; + try { require $dropin_path; } catch ( Throwable $e ) {