WordPress.org

Make WordPress Core

Ticket #39047: 39047.diff

File 39047.diff, 1.1 KB (added by pento, 3 years ago)
  • src/wp-includes/script-loader.php

     
    504504        $scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 );
    505505        $scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'jquery', 'media-views', 'media-audiovideo' ), false, 1 );
    506506
     507        $options_table_exists = true;
     508        if ( wp_installing() ) {
     509                global $wpdb;
     510                $options_table_exists = ( $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->options ) ) ) != null );
     511        }
    507512        $scripts->add( 'wp-api', "/wp-includes/js/wp-api$suffix.js", array( 'jquery', 'backbone', 'underscore' ), false, 1 );
    508513        did_action( 'init' ) && $scripts->localize( 'wp-api', 'wpApiSettings', array(
    509514                'root'          => esc_url_raw( get_rest_url() ),
    510                 'nonce'         => wp_create_nonce( 'wp_rest' ),
     515                'nonce'         => $options_table_exists ? wp_create_nonce( 'wp_rest' ) : '',
    511516                'versionString' => 'wp/v2/',
    512517        ) );
    513518