• I recently upgraded from 3.4 to 3.6.1 and received this error.

    The error can be seen here at the top of every one of my pages.
    https://www.RockCastleStorage.com

    Error
    Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/08/8767108/html/wp-content/themes/revelation-theme/lib/theme-sidebars.php on line 51 and defined in /home/content/08/8767108/html/wp-includes/wp-db.php on line 992

    I looked at the files and the theme-sidebars.php on line 51 reads:
    $widgetized_pages = $wpdb->get_col( $wpdb->prepare(“SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = ‘celta_sidebar'” ) );

    The line on 992 in wp-db.php it reads:
    function prepare( $query, $args ) {

    Not sure if this is the info needed to fix, but that is what the error is referring to.

    Any help would be awesome.

    Thanks,

    Dustin

    PS. I tried to error out my wp-config.php file to hide the error with “@ini_set(‘display_errors’, 0);”. But had no luck on hiding the error.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Do you get this issue if you use the default theme? It looks like you are using a premium theme and they are not supported on this forum. Have you tried to contact the theme author?

    Thread Starter deehill125

    (@deehill125)

    Unfortunately, the theme author is no longer on themeforest.net (where I purchased the theme). So kind of in a pinch!

    Thread Starter deehill125

    (@deehill125)

    I am afraid if I switch the theme, all my current theme updates will be reset when I re-activate my theme.

    Here’s some info on this error that may be helpful:

    PHP Warning: Missing argument 2 for wpdb::prepare()

    I am afraid if I switch the theme, all my current theme updates will be reset when I re-activate my theme.

    Switching themes should not modify the theme.

    Thread Starter deehill125

    (@deehill125)

    WPyogi.. I did see that page and it’s a bit over my head. I usually Google problems before I post anything because someone has most likely encountered the same problem. But I can’t seem to find a solution.

    Thanks for the help so far.. It is theme releated.

    I did take a backup of the older version of wordpress, I may just restore from that.

    You should be aware that using an outdated version of WP is a major security risk – so that’s really not a good option.

    Personally, I’d look for a new theme that’s being actively supported – in the long run, you’ll likely have to do that anyway as un-maintained themes are likely to have more compatibility issues going forward.

    Thread Starter deehill125

    (@deehill125)

    Very true… I just don’t have the time right now to re-do the entire site. That will be a future plan for sure.

    Thread Starter deehill125

    (@deehill125)

    I also came across a couple of forums talking about:

    “Adding “null” as a second argument to the function fixes the problem completely.”

    I am not sure how to mark this up or if this will even work, but might be worth a shot.

    Try changing this
    $widgetized_pages = $wpdb->get_col( $wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = 'celta_sidebar'" ) );
    To this:

    $widgetized_pages = $wpdb->get_col("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = 'celta_sidebar'");

    Thread Starter deehill125

    (@deehill125)

    Hey bloke.. what file would I open to find this?

    Thanks for the help,
    DH

    You said that code was in theme-sidebars.php on line 51

    Thread Starter deehill125

    (@deehill125)

    That worked perfectly!! Thanks Bloke.

    Reason why I asked was that there are two php files that were giving errors.

    theme-sidebars.php and wp-db.php.

    Thanks again for everyone’s help!!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Warning: Missing argument 2 for wpdb::prepare()’ is closed to new replies.