I am now having a similar error on one of my pages. I am not running any of the plugins you mentioned.
My error was related to a ‘nextgen-gallery’ plugin.
“Warning: Missing argument 2 for wpdb::prepare(), called in ../nextgen-gallery/lib/tags.php on line 315 and defined in ../wp-includes/wp-db.php on line 990”
By the looks of it, wpdb::prepare() function, inside wp-db.php, now requires an array of arguments to be passed to it.
example, $wpdb->prepare($query, $args)
My gallery plugin used this function to submit a request query to the database but wasn’t including any $args.
I have the same problem
“Warning: Missing argument 2 for wpdb::prepare()” on my iphrom plugins
this message come when i upgrade wordpress to 3.5 this morning
Find the line in your error, add arguments parameter after query. This should fix it up on any script. Or you could always disable effected plugin until the author corrects.
If you’re a user: Your site is fine. If you’re a plugin/theme author, please read: http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/. If you’re a user, please point your plugin/theme author to that post.
I have checked all the strings of all plugins.. but nothing there. The problem is showing in Admin files. admin-options.php and all.. what to do.?
Is there something in which anyone can help me? I got this code from admin-options.php
<?php
}
do_action( ‘appthemes_add_submenu_page_content’ );
function app_dashboard() {
global $wpdb, $app_edition, $app_rss_feed;
global $app_twitter_rss_feed, $app_forum_rss_feed, $options_dashboard;
$count_live = $wpdb->get_var( $wpdb->prepare( “SELECT count(ID) FROM $wpdb->posts WHERE post_status IN (‘publish’, ‘unreliable’) AND post_type = ‘”.APP_POST_TYPE.”‘” ) );
$count_pending = $wpdb->get_var( $wpdb->prepare( “SELECT count(ID) FROM $wpdb->posts WHERE post_type = ‘”.APP_POST_TYPE.”‘ AND post_status = ‘pending'” ) );
//$job_rev_total = $wpdb->get_var($wpdb->prepare(“SELECT sum(mc_gross) FROM $wpdb->prefix” . ‘clpr_order_info’));
?>
What to change in this?
First backup (download) the file by using FTP or whatever file management application your host provides.
Try changing this:
$count_live = $wpdb->get_var( $wpdb->prepare( "SELECT count(ID) FROM $wpdb->posts WHERE post_status IN ('publish', 'unreliable') AND post_type = '".APP_POST_TYPE."'" ) );
$count_pending = $wpdb->get_var( $wpdb->prepare( "SELECT count(ID) FROM $wpdb->posts WHERE post_type = '".APP_POST_TYPE."' AND post_status = 'pending'" ) );
to this:
$count_live = $wpdb->get_var( $wpdb->prepare( "SELECT count(ID) FROM $wpdb->posts WHERE post_status IN ('publish', 'unreliable') AND post_type = '%s'",APP_POST_TYPE ) );
$count_pending = $wpdb->get_var( $wpdb->prepare( "SELECT count(ID) FROM $wpdb->posts WHERE post_type = '%s' AND post_status = 'pending'", APP_POST_TYPE ) );
Oh My God… Thank you Keesiemeijer… Thanks a lot.. You saved my BUTT π
You’re welcome. I’m glad you got it resolved.
Can you notify the theme author or vendor that their theme has some issues with WordPress 3.5.
hi, i have the same error a little different but is here:
Warning: Missing argument 2 for wpdb::prepare(), called in /home/xxxxxx/public_html/wp/wp-content/themes/xxxxxxxx/includes/admin/admin-options.php on line 843 and defined in /home/xxxxxxx/public_html/wp/wp-includes/wp-db.php on line 990
—————–
$ad_rev_total = $wpdb->get_var( $wpdb->prepare( "SELECT sum(mc_gross) FROM $wpdb->cp_order_info" ) );
$customers_today = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM $wpdb->users INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $wpdb->usermeta.meta_key = %s AND ($wpdb->usermeta.meta_value NOT LIKE %s) AND $wpdb->users.user_registered >= %s", $capabilities_meta, '%administrator%', $date_today ) );
$customers_yesterday = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM $wpdb->users INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $wpdb->usermeta.meta_key = %s AND ($wpdb->usermeta.meta_value NOT LIKE %s) AND $wpdb->users.user_registered BETWEEN %s AND %s", $capabilities_meta, '%administrator%', $date_yesterday, $date_today ) );
$countusers = count_users();
?>
anyone knows how to fix it ?
As always back up the file the file by using FTP or whatever file management application your host provides.
Try changing this:
$ad_rev_total = $wpdb->get_var( $wpdb->prepare( "SELECT sum(mc_gross) FROM $wpdb->cp_order_info" ) );
to this:
$ad_rev_total = $wpdb->get_var( "SELECT sum(mc_gross) FROM $wpdb->cp_order_info" );
And please notify the theme author or vendor that their theme has an issues with WordPress 3.5.
http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/.
Thank you so much keesiemeijer it solved !! No more appearing this error !
I will definetely contact the vendor about it !
have a nice day
best regards,
Snu
@snurex
I’m glad you got it resolved.