WordPress.org

Make WordPress Core

Ticket #15054: get_option_filter.patch

File get_option_filter.patch, 1.0 KB (added by leogermani, 4 years ago)

add filter to get_option function

  • wp-includes/functions.php

     
    296296 *      Any value other than false will "short-circuit" the retrieval of the option 
    297297 *      and return the returned value. You should not try to override special options, 
    298298 *      but you will not be prevented from doing so. 
     299 * @uses apply_filters() Calls 'get_option' before checking the option passing the 
     300 *  option name and the default value as paramaters to be filtered.  
     301 *  Any value other than false will "short-circuit" the retrieval of the option 
    299302 * @uses apply_filters() Calls 'option_$option', after checking the option, with 
    300303 *      the option value. 
    301304 * 
     
    314317        if ( empty($option) ) 
    315318                return false; 
    316319 
     320    $filtered_value = apply_filters('get_option', false, $option, $default); 
     321    if (false !== $filtered_value) 
     322        return $filtered_value; 
     323 
    317324        if ( defined( 'WP_SETUP_CONFIG' ) ) 
    318325                return false; 
    319326