Make WordPress Core

Changeset 20783


Ignore:
Timestamp:
05/14/2012 04:45:32 PM (12 years ago)
Author:
ryan
Message:

Add filters for the default to get_option() and get_site_option(). Provide default overrides in the customizer. Props Otto42. see #20448

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-customize-setting.php

    r20645 r20783  
    6969                if ( empty( $this->id_data[ 'keys' ] ) )
    7070                    add_filter( 'pre_option_' . $this->id_data[ 'base' ], array( $this, '_preview_filter' ) );
    71                 else
     71                else {
    7272                    add_filter( 'option_' . $this->id_data[ 'base' ], array( $this, '_preview_filter' ) );
     73                    add_filter( 'default_option_' . $this->id_data[ 'base' ], array( $this, '_preview_filter' ) );
     74                }
    7375                break;
    7476            default :
  • trunk/wp-includes/option.php

    r20287 r20783  
    4444    if ( defined( 'WP_SETUP_CONFIG' ) )
    4545        return false;
     46
     47    $default = apply_filters( 'default_option_' . $option, $default );
    4648
    4749    if ( ! defined( 'WP_INSTALLING' ) ) {
     
    755757        return $pre;
    756758
     759    $default = apply_filters( 'default_site_option_' . $option, $default );
     760
    757761    if ( !is_multisite() ) {
    758762        $value = get_option($option, $default);
Note: See TracChangeset for help on using the changeset viewer.