Ticket #7637: get_option.patch
| File get_option.patch, 1011 bytes (added by azaozz, 5 years ago) |
|---|
-
wp-includes/functions.php
330 330 * @param string $setting Name of option to retrieve. Should already be SQL-escaped 331 331 * @return mixed Value set for the option. 332 332 */ 333 function get_option( $setting ) {333 function get_option( $setting, $default = false ) { 334 334 global $wpdb; 335 335 336 336 // Allow plugins to short-circuit options. … … 341 341 // prevent non-existent options from triggering multiple queries 342 342 $notoptions = wp_cache_get( 'notoptions', 'options' ); 343 343 if ( isset( $notoptions[$setting] ) ) 344 return false;344 return $default; 345 345 346 346 $alloptions = wp_load_alloptions(); 347 347 … … 364 364 } else { // option does not exist, so we must cache its non-existence 365 365 $notoptions[$setting] = true; 366 366 wp_cache_set( 'notoptions', $notoptions, 'options' ); 367 return false;367 return $default; 368 368 } 369 369 } 370 370 }