WordPress.org

Make WordPress Core

Changeset 39382


Ignore:
Timestamp:
11/30/16 21:21:21 (7 months ago)
Author:
ocean90
Message:

Options: Pass the $passed_default parameter to the 'default_option_{$option} filter in add_option().

This was missed in [38910].

Props joehoyle, lucasstark.
See #38176.
Fixes #38930.

Location:
trunk
Files:
2 edited

Legend:

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

    r39335 r39382  
    422422    if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) ) 
    423423        /** This filter is documented in wp-includes/option.php */ 
    424         if ( apply_filters( 'default_option_' . $option, false, $option ) !== get_option( $option ) ) 
     424        if ( apply_filters( 'default_option_' . $option, false, $option, false ) !== get_option( $option ) ) 
    425425            return false; 
    426426 
  • trunk/tests/phpunit/tests/option/registration.php

    r38910 r39382  
    6363 
    6464    /** 
     65     * @ticket 38930 
     66     */ 
     67    public function test_add_option_with_no_options_cache() { 
     68        register_setting( 'test_group', 'test_default', array( 
     69            'default' => 'My Default :)', 
     70        )); 
     71        wp_cache_delete( 'notoptions', 'options' ); 
     72        $this->assertTrue( add_option( 'test_default', 'hello' ) ); 
     73        $this->assertEquals( 'hello', get_option( 'test_default' ) ); 
     74    } 
     75 
     76    /** 
    6577     * @expectedDeprecated register_setting 
    6678     */ 
Note: See TracChangeset for help on using the changeset viewer.