From 62784396c1a7b23be6e14b17c552f1bc71b14ec9 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Thu, 5 Jan 2017 08:17:19 +0000 Subject: [PATCH] Upgrade/Install: Avoid creating nonce during installation. 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 isn't available during installation, we can safely skip creating a nonce. Props nullvariable, pento, dd32, rmccue. Merges [39684] to the 4.7 branch. Fixes #39047. git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39697 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/script-loader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index be32073c03..b9b2bdbcac 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -507,7 +507,7 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'wp-api', "/wp-includes/js/wp-api$suffix.js", array( 'jquery', 'backbone', 'underscore' ), false, 1 ); did_action( 'init' ) && $scripts->localize( 'wp-api', 'wpApiSettings', array( 'root' => esc_url_raw( get_rest_url() ), - 'nonce' => wp_create_nonce( 'wp_rest' ), + 'nonce' => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ), 'versionString' => 'wp/v2/', ) );