A previous developer created a plugin for a website I manage and everything seems to work okay, except I'm getting the error "Missing argument 2 for wpdb::prepare()". I understand that the arguments need to be added, but I'm not clear how to add them in to this specific code, or what arguments to add in this case.
The code is below. Any pointers would be amazing. The error comes up after the fourth closing curly bracket, before "$judges =". It seems also like the query should now be $wpdb->prepare, but again, I'm not clear in this instance how to implement that into this code.
Apologies, but I am a big bone-head. The code below is the real code from the plugin. I had looked at the wrong line of code previously.
$categories = $wpdb->get_results($wpdb->prepare(sprintf("SELECT c.categoryid as id, c.name, c.public, COUNT(jc.categoryid) as submissions FROM ".$wpdb->prefix."judge_category c LEFT JOIN ". $wpdb->prefix. "judge_submission_category jc ON jc.categoryid = c.categoryid %s GROUP BY c.categoryid %s",$_where, $_order)));
Based on the feedback already provided, I'll see if I can make it work now and I'll post the correct answer once I figure it out, unless anyone else spots it first.