Title: Missing Argument 2 for wpdb::prepare()
Last modified: August 20, 2016

---

# Missing Argument 2 for wpdb::prepare()

 *  Resolved [sashamenis](https://wordpress.org/support/users/sashamenis/)
 * (@sashamenis)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/)
 * After updating wordpress to 3.5 I am getting this error.
 * Warning: Missing argument 2 for wpdb::prepare(), called in /home/cpanel/public_html/
   wp-content/themes/clipper/includes/admin/admin-options.php on line 291 and defined
   in /home/cpanel/public_html/wp-includes/wp-db.php on line 990
 * Warning: Missing argument 2 for wpdb::prepare(), called in /home/cpanel/public_html/
   wp-content/themes/clipper/includes/admin/admin-options.php on line 292 and defined
   in /home/cpanel/public_html/wp-includes/wp-db.php on line 990
 * I am using, Akismet, Internal link builder, WP Security and WP Smush.it plugins.
   Is it related to any of these plugins?

Viewing 15 replies - 1 through 15 (of 26 total)

1 [2](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/page/2/?output_format=md)

 *  [stephen.pfaff](https://wordpress.org/support/users/stephenpfaff/)
 * (@stephenpfaff)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/#post-3262921)
 * I am now having a similar error on one of my pages. I am not running any of the
   plugins you mentioned.
 *  [stephen.pfaff](https://wordpress.org/support/users/stephenpfaff/)
 * (@stephenpfaff)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/#post-3262923)
 * 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.
 *  [betme88](https://wordpress.org/support/users/betme88/)
 * (@betme88)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/#post-3262924)
 * 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
 *  [stephen.pfaff](https://wordpress.org/support/users/stephenpfaff/)
 * (@stephenpfaff)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/#post-3262925)
 * 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.
 *  [stephen.pfaff](https://wordpress.org/support/users/stephenpfaff/)
 * (@stephenpfaff)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/#post-3262926)
 * Check this, [http://wordpress.org/support/topic/error-with-wp-35-wpdbprepare?replies=2](http://wordpress.org/support/topic/error-with-wp-35-wpdbprepare?replies=2)
 * The function now requires 2 parameters, as of WP 3.5
 *  [Andrew Nacin](https://wordpress.org/support/users/nacin/)
 * (@nacin)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/#post-3262936)
 * 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/](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.
 *  Thread Starter [sashamenis](https://wordpress.org/support/users/sashamenis/)
 * (@sashamenis)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/#post-3262947)
 * 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.?
 *  Thread Starter [sashamenis](https://wordpress.org/support/users/sashamenis/)
 * (@sashamenis)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/#post-3262948)
 * 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?
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/#post-3262949)
 * First backup (download) the file by using [FTP](http://codex.wordpress.org/FTP_Clients)
   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 ) );
       ```
   
 *  Thread Starter [sashamenis](https://wordpress.org/support/users/sashamenis/)
 * (@sashamenis)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/#post-3262954)
 * Oh My God… Thank you Keesiemeijer… Thanks a lot.. You saved my BUTT 😀
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/#post-3262955)
 * 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.
 *  [Roberto](https://wordpress.org/support/users/snurex/)
 * (@snurex)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/#post-3262957)
 * 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 ?
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/#post-3262958)
 * 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/](http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/).
 *  [Roberto](https://wordpress.org/support/users/snurex/)
 * (@snurex)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/#post-3262960)
 * 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
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/#post-3262961)
 * [@snurex](https://wordpress.org/support/users/snurex/)
    I’m glad you got it resolved.

Viewing 15 replies - 1 through 15 (of 26 total)

1 [2](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/page/2/?output_format=md)

The topic ‘Missing Argument 2 for wpdb::prepare()’ is closed to new replies.

## Tags

 * [clipper](https://wordpress.org/support/topic-tag/clipper/)

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 26 replies
 * 11 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/missing-argument-2-for-wpdbprepare-3/page/2/#post-3262984)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
