Skip to content

Commit

Permalink
Use wpdb prepare instead of sanitize text field
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronHolbrook committed Jun 29, 2017
1 parent 434d873 commit d5757ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zeek/wp-utils",
"description": "A collection of functions that provide utility functionality for WordPress.",
"version": "0.4.0",
"version": "0.4.1",
"type": "library",
"license": "proprietary",
"authors": [
Expand Down
15 changes: 11 additions & 4 deletions utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,26 @@ function get_id_from_slug( $slug, $post_type = 'post', $force = false ) {
*
* @return int
*/
/**
* Performs a very direct, simple query that bypasses the normal WP caching
*
* @param $key
*
* @return int
*/
function get_raw_option_value( $key ) {
global $wpdb;

$sql = sprintf( "
$sql = $wpdb->prepare( "
SELECT
option_value
FROM
wp_options
{$wpdb->options}
WHERE
option_name = '%s'
option_name = %s
LIMIT 1
",
sanitize_text_field( $key )
$key
);

$version = $wpdb->get_var( $sql );
Expand Down

0 comments on commit d5757ca

Please sign in to comment.