| 183 | * Retrieves boolean to check if option exists or not. |
| 184 | * |
| 185 | * This is preferred method rather than using `if (!get_options("xyz"))` because this |
| 186 | * will be misleading if option has legitimate value of `0/false/null/empty-string`. |
| 187 | * |
| 188 | * |
| 189 | * @since 5.5.3 |
| 190 | * |
| 191 | * @global wpdb $wpdb WordPress database abstraction object. |
| 192 | * |
| 193 | * @param string $option_name Name of the option to retrieve. Expected to not be SQL-escaped. |
| 194 | * @param mixed $site_wide Optional. If user checks for current site or network option. |
| 195 | */ |
| 196 | function option_exists( $option_name, $site_wide = false ) { |
| 197 | global $wpdb; |
| 198 | return $wpdb->query( $wpdb->prepare( "SELECT * FROM ". ($site_wide ? $wpdb->base_prefix : $wpdb->prefix). "options WHERE option_name ='%s' LIMIT 1", $option_name ) ); |
| 199 | } |
| 200 | |
| 201 | |
| 202 | /** |