Make WordPress Core

Ticket #43598: 43598.diff

File 43598.diff, 2.3 KB (added by soulseekah, 7 years ago)
  • src/wp-includes/option.php

    diff --git src/wp-includes/option.php src/wp-includes/option.php
    index a80de70..88a0a1f 100644
    function get_network_option( $network_id, $option, $default = false ) { 
    12431243                return $pre;
    12441244        }
    12451245
    1246         // prevent non-existent options from triggering multiple queries
    1247         $notoptions_key = "$network_id:notoptions";
    1248         $notoptions     = wp_cache_get( $notoptions_key, 'site-options' );
     1246        if ( is_multisite() ) {
     1247                // prevent non-existent options from triggering multiple queries
     1248                $notoptions_key = "$network_id:notoptions";
     1249                $notoptions     = wp_cache_get( $notoptions_key, 'site-options' );
    12491250
    1250         if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) {
     1251                if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) {
    12511252
    1252                 /**
    1253                  * Filters a specific default network option.
    1254                  *
    1255                  * The dynamic portion of the hook name, `$option`, refers to the option name.
    1256                  *
    1257                  * @since 3.4.0
    1258                  * @since 4.4.0 The `$option` parameter was added.
    1259                  * @since 4.7.0 The `$network_id` parameter was added.
    1260                  *
    1261                  * @param mixed  $default    The value to return if the site option does not exist
    1262                  *                           in the database.
    1263                  * @param string $option     Option name.
    1264                  * @param int    $network_id ID of the network.
    1265                  */
    1266                 return apply_filters( "default_site_option_{$option}", $default, $option, $network_id );
     1253                        /**
     1254                         * Filters a specific default network option.
     1255                         *
     1256                         * The dynamic portion of the hook name, `$option`, refers to the option name.
     1257                         *
     1258                         * @since 3.4.0
     1259                         * @since 4.4.0 The `$option` parameter was added.
     1260                         * @since 4.7.0 The `$network_id` parameter was added.
     1261                         *
     1262                         * @param mixed  $default    The value to return if the site option does not exist
     1263                         *                           in the database.
     1264                         * @param string $option     Option name.
     1265                         * @param int    $network_id ID of the network.
     1266                         */
     1267                        return apply_filters( "default_site_option_{$option}", $default, $option, $network_id );
     1268                }
    12671269        }
    12681270
    12691271        if ( ! is_multisite() ) {
    function get_network_option( $network_id, $option, $default = false ) { 
    12951297                }
    12961298        }
    12971299
    1298         if ( ! is_array( $notoptions ) ) {
     1300        if ( isset( $notoptions ) && ! is_array( $notoptions ) ) {
    12991301                $notoptions = array();
    13001302                wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
    13011303        }