Make WordPress Core


Ignore:
Timestamp:
05/14/2012 05:00:13 PM (13 years ago)
Author:
ryan
Message:

Call filters for default option values only as needed to reduce number of filter calls. Props Ott042. see #20448

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/option.php

    r20783 r20784  
    4545        return false;
    4646
    47     $default = apply_filters( 'default_option_' . $option, $default );
    48 
    4947    if ( ! defined( 'WP_INSTALLING' ) ) {
    5048        // prevent non-existent options from triggering multiple queries
    5149        $notoptions = wp_cache_get( 'notoptions', 'options' );
    5250        if ( isset( $notoptions[$option] ) )
    53             return $default;
     51            return apply_filters( 'default_option_' . $option, $default );
    5452
    5553        $alloptions = wp_load_alloptions();
     
    7068                    $notoptions[$option] = true;
    7169                    wp_cache_set( 'notoptions', $notoptions, 'options' );
    72                     return $default;
     70                    return apply_filters( 'default_option_' . $option, $default );
    7371                }
    7472            }
     
    8179            $value = $row->option_value;
    8280        else
    83             return $default;
     81            return apply_filters( 'default_option_' . $option, $default );
    8482    }
    8583
     
    757755        return $pre;
    758756
    759     $default = apply_filters( 'default_site_option_' . $option, $default );
    760 
    761     if ( !is_multisite() ) {
     757    if ( ! is_multisite() ) {
     758        $default = apply_filters( 'default_site_option_' . $option, $default );
    762759        $value = get_option($option, $default);
    763760    } else {
     
    775772                wp_cache_set( $cache_key, $value, 'site-options' );
    776773            } else {
    777                 $value = $default;
     774                $value = apply_filters( 'default_site_option_' . $option, $default );
    778775            }
    779776        }
Note: See TracChangeset for help on using the changeset viewer.