Upgrade/Install: Avoid creating nonce during installation.

This avoids a "Table `wp_options` doesn't exist" database error when trying to create a nonce for password reset button.

When installing and using database-saved salts, `wp_create_nonce()` causes database errors as `wp_salt()` attempts to insert into the not-yet-created options table. Since authentication is not available during installation, we can safely skip creating a nonce.

Follow-up to [39684], [50129].

Props schlessera, swissspidy, sanketchodavadiya, hellofromTonya, SergeyBiryukov.
Fixes #53830.

git-svn-id: https://develop.svn.wordpress.org/trunk@51525 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2021-08-02 16:37:57 +00:00
parent 2ba4a4817a
commit 3a189c93e1

View File

@@ -1097,7 +1097,7 @@ function wp_default_scripts( $scripts ) {
'userProfileL10n',
array(
'user_id' => $user_id,
'nonce' => wp_create_nonce( 'reset-password-for-' . $user_id ),
'nonce' => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'reset-password-for-' . $user_id ),
)
);