Ticket #37178: 37178.diff
File 37178.diff, 1.3 KB (added by , 8 years ago) |
---|
-
wp-includes/option.php
23 23 * 24 24 * @global wpdb $wpdb WordPress database abstraction object. 25 25 * 26 * @param string $option Name of option to retrieve. Expected to not be SQL-escaped. 27 * @param mixed $default Optional. Default value to return if the option does not exist. 26 * @param string $option Name of option to retrieve. Expected to not be SQL-escaped. 27 * @param mixed $default Optional. Default value to return if the option does not exist. 28 * @param bool $cache_only If set to true, no query will be done if there is no cached option. 28 29 * @return mixed Value set for the option. 29 30 */ 30 function get_option( $option, $default = false ) {31 function get_option( $option, $default = false, $cache_only = false ) { 31 32 global $wpdb; 32 33 33 34 $option = trim( $option ); … … 83 84 $value = wp_cache_get( $option, 'options' ); 84 85 85 86 if ( false === $value ) { 87 if ( $cache_only ) { 88 return false; 89 } 86 90 $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) ); 87 91 88 92 // Has to be get_row instead of get_var because of funkiness with 0, false, null values