Ticket #21459: 21459-filter.diff
File 21459-filter.diff, 1.8 KB (added by , 12 years ago) |
---|
-
wp-includes/option.php
32 32 function get_option( $option, $default = false ) { 33 33 global $wpdb; 34 34 35 $filter = is_ms_switched() ? 'blog_option_' : 'option_'; 36 35 37 // Allow plugins to short-circuit options. 36 $pre = apply_filters( 'pre_ option_'. $option, false );38 $pre = apply_filters( 'pre_' . $filter . $option, false ); 37 39 if ( false !== $pre ) 38 40 return $pre; 39 41 … … 48 50 // prevent non-existent options from triggering multiple queries 49 51 $notoptions = wp_cache_get( 'notoptions', 'options' ); 50 52 if ( isset( $notoptions[$option] ) ) 51 return apply_filters( 'default_ option_'. $option, $default );53 return apply_filters( 'default_' . $filter . $option, $default ); 52 54 53 55 $alloptions = wp_load_alloptions(); 54 56 … … 67 69 } else { // option does not exist, so we must cache its non-existence 68 70 $notoptions[$option] = true; 69 71 wp_cache_set( 'notoptions', $notoptions, 'options' ); 70 return apply_filters( 'default_ option_'. $option, $default );72 return apply_filters( 'default_' . $filter . $option, $default ); 71 73 } 72 74 } 73 75 } … … 78 80 if ( is_object( $row ) ) 79 81 $value = $row->option_value; 80 82 else 81 return apply_filters( 'default_ option_'. $option, $default );83 return apply_filters( 'default_' . $filter . $option, $default ); 82 84 } 83 85 84 86 // If home is not set use siteurl. … … 88 90 if ( in_array( $option, array('siteurl', 'home', 'category_base', 'tag_base') ) ) 89 91 $value = untrailingslashit( $value ); 90 92 91 return apply_filters( 'option_'. $option, maybe_unserialize( $value ) );93 return apply_filters( $filter . $option, maybe_unserialize( $value ) ); 92 94 } 93 95 94 96 /**