Skip to content

Instantly share code, notes, and snippets.

@skyebook
Created December 11, 2012 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skyebook/4262228 to your computer and use it in GitHub Desktop.
Save skyebook/4262228 to your computer and use it in GitHub Desktop.
WPDB::Prepare Fix for WordPress 3.5
<?php
// Old (single argument) function call
global $wpdb;
$authorIDs = $wpdb->get_col($wpdb->prepare("SELECT post_author FROM " . $wpdb->posts . " WHERE ID = " . intval($postID) . " LIMIT 1");
// New (two argument) function call
global $wpdb;
$authorIDs = $wpdb->get_col($wpdb->prepare("SELECT post_author FROM " . $wpdb->posts . " WHERE ID = " . intval($postID) . " LIMIT 1", array()));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment