“Warning: Missing argument 2 for wpdb::prepare()”
How do I fix it?
If you are seeing an error after upgrading to WordPress 3.5 that says something like this, you need to upgrade your theme.
We have fixed this with all of our themes and they are ready to download and re-install from your account page.
What if I have customized my theme’s code and don’t want to upgrade?
For those of you who have customized your theme’s code and don’t want to do a full upgrade, you’ll need to take a look at the warning message.
Here’s a sample error we have fixed from the Biznify Theme:
Warning: Missing argument 2 for wpdb::prepare(), called in /home/mintthem/public_html/demo/wp-content/themes/Biznify/products-pagetemplate.php on line 39 and defined in /home/mintthem/public_html/demo/wp-includes/wp-db.php on line 990
Step 1: Open the file it tells you to open. In this case, it is products-pagetemplate.php and Go to the line it refers to. In this case it is line 39
Step 2: Find the code that looks like this: $wpdb->prepare(“SELECT price FROM $table_name WHERE item_number = ‘$item_number’;”)
Step 3: Replace $item_number with %d
Step 4: Add $item_number after the last quotation mark. Also, make sure to put a comma before it. (notice the comma before $item_number below)
Example: $wpdb->prepare(“SELECT price FROM $table_name WHERE item_number = ‘%d‘;”, $item_number)
1More
1More
Music Grunge Magazine Wordpress Theme - 6 views
1More
Common WordPress SEO That Even You Can Fix - 0 views
1More
8 Most common WordPress Errors and How to Fix Them - 1 views
1More
How To Make Your WordPress Site Load Faster - 1 views
How To Fix Auto Post Thumbnail on WordPress 3.4 (SEO-Friendly!) | ClickThrough Marketing - 3 views
1More
WordPress › Peter's Login Redirect « WordPress Plugins - 0 views
1More
Free Wordpress Themes Blue Black Template - 0 views
1More