Support » Fixing WordPress » Front-end warning: Missing Argument for wpdb

  • Resolved noelani


    I’m getting this error message. I’ve looked up solutions but all the ones I’ve found relate to specific plugins or don’t exactly address the issue I have, because it’s something conflicting with the premium theme I’m using and the creator as packed up and shipped off. He dosn’t offer support for this anymore.

    Below is the error message I’m getting. Can anyone help?

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/XXX/public_html/ on line 77 and defined in /home/XXXX/public_html/ on line 990

Viewing 15 replies - 1 through 15 (of 22 total)
  • Hi noelani,

    You should disable error reporting/display and contact the author of your theme about the error.

    You can refer them to this link:

    I tried because his widgets kept breaking, but he never responded. Now he has disappeared and has no forwarding information to contact. Can I solve the issue myself with the information in the link?

    Moderator Ipstenu (Mika Epstein)


    🏳️‍🌈 Plugin Review Team Rep

    Is it the one from ?

    No, it’s not from there. I actually just got a response from the site where I purchased it from. The seller has disappeared, removed his website and deleted all his social network pages. They are going to rectify the situation for me. So maybe I can just scrap this one and get a new theme. It’s not worth the headache anymore.

    I’m in the same exact situation with a missing author, though judging by the the error you posted we are using a different theme. I’m in too deep to use a different theme, what are my options in terms of having someone look at my code or troubleshooting this on my own?

    If you have a good web hosting company one of their technical support technicians might help you out. My sites are hosted through and although they do not and are not required to offer third party support, they’ve helped me with issues from time to time.

    If you create a new topic, somebody can probably help you out.

    I’m getting

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/h/e/a/healingheart1/html/HHC/wp-content/plugins/wp-super-edit/wp-super-edit.core.class.php on line 114 and defined in /home/content/h/e/a/healingheart1/html/HHC/wp-includes/wp-db.php on line 990

    This appeared after upgrading the 2 wordpress themes 2010 & 2011 or from upgrading to WordPress 3.5. How can I fix this?

    We use all of the settings, themes, etc directly from the generic install of wordpress.

    I’m getting these errors also. I use a Nimble theme. Errors on lines 8, 81 & 102

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/marviene/public_html/wp-content/themes/dt-nimble/functions/core/core-filters.php on line 8 and defined in /home/marviene/public_html/wp-includes/wp-db.php on line 990


    Warning: Missing argument 2 for wpdb::prepare(), called in /home/marviene/public_html/wp-content/themes/dt-nimble/functions/core/core-functions.php on line 81 and defined in /home/marviene/public_html/wp-includes/wp-db.php on line 990


    Warning: Missing argument 2 for wpdb::prepare(), called in /home/marviene/public_html/wp-content/themes/dt-nimble/functions/core/core-functions.php on line 102 and defined in /home/marviene/public_html/wp-includes/wp-db.php on line 990


    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    This warning occurs when somebody is using the $wpdb->prepare function incorrectly. It’s a bad warning to have too, because it indicates a usage of prepare() in a way that can be a security risk.

    Fixing it depends on the specific problem.

    Here’s an example line of code that I took from a plugin that was doing-it-wrong:

    $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->comments SET comment_parent=$parentID WHERE comment_ID=$commentID;" ) );

    The basic problem is that they’re using the prepare statement incorrectly by including the variables of $parentID and $commentID directly in the SQL statement. They should be using placeholders, and then including the variables later.

    This code is dangerous, because it leads to the possibility of what is called an “SQL Injection Exploit”. Which is shorthand for a specific way to hack your site.

    Here’s the fixed code:

    $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->comments SET comment_parent=%d WHERE comment_ID=%d;", $parentID, $commentID ) );

    Basically, since both of these are supposed to be integers, I replaced the variables in the statement with %d and then put the variables are the end of the prepare() statement. This is how prepare is supposed to be used. If they were strings, I would have used %s instead.

    So if you want to fix the issue, you need to find the line of code with the problem, and correct it. This eliminates the exploit. And the warning message.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    If the message is coming from a plugin, then the best course of action is to:
    a) deactivate the plugin and
    b) notify the author.

    With a theme, notifying the author is good, but if you can’t get them to fix it, then you’ll need to fix it yourself.

    What do you mean the author? them? It – is – from – WordPress!!

    Why did they tell us to upgrade if their update is broken? I have no idea what you are even talking about. This is supposed to be the user-friendly web publishing software. All I do is point and click like the directions tell me to.

    I do know where to deactivate plug-ins so I guess that’s my only choice, and hope the website doesn’t implode *lol*.

    Thanks for your answer!!

    Hi Samuel,
    Since it states two lines of code in the error message, I’m assuming that’s where the problem is, but again, I’m not a coder, so knowing where the problem is doesn’t help, because I’m lost after that. I spent a couple hours going over it and looking on google for a solution, but I was scared to change anything that didn’t specifically relate to where the problem is. For instance, mine is with a line of code in the theme, so I didn’t want to use a plugin fix for something that effects the theme. Does that make sense?

    Here are the lines of code mentioned in the error message:

    in wp-db.php:

    function prepare( $query, $args ) {

    and in the theme in functions/custom-functions.php

    $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM " . $prefix . "posts" . " WHERE guid='" . $image_url . "';"));

    If you could help I would greatly appreciate it.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    @rmgalica: The error message you posted indicates that the error is coming from a plugin called “wp-super-edit”. The key is to read the error message, specifically, this part:

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/h/e/a/healingheart1/html/HHC/wp-content/plugins/wp-super-edit/wp-super-edit.core.class.php on line 114

    The author of that plugin is not “WordPress”, it is the guy listed as the author on the plugin page:

    @noelani: Your error message is coming from the theme. The second line of code states where the function is defined, where it’s called from is the problem.

    In your case, that line of code you posted is definitely the problem. Here’s the fixed version of that line:

    $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM " . $prefix . "posts WHERE guid=%s;", $image_url));

    Thanks so much, Samuel, well that definitely fixed that particular issue. I turned back on the error reporting and no more warning!

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘Front-end warning: Missing Argument for wpdb’ is closed to new replies.