WordPress.org

Support

Support » Themes and Templates » Blocks2 » Warning: Missing argument 2 for wpdb::prepare()

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

  • For anyone experiencing the error Warning: Missing argument 2 for wpdb::prepare() with Blocks2 on recent versions of wordpress, the easiest solution is to change line 145 of Header.php from

    $post_datetimes = $wpdb->get_row($wpdb->prepare("SELECT YEAR(min(post_date_gmt)) AS firstyear, YEAR(max(post_date_gmt)) AS lastyear FROM $wpdb->posts WHERE post_date_gmt > 1970"));

    to

    $post_datetimes = $wpdb->get_row($wpdb->prepare("SELECT YEAR(min(post_date_gmt)) AS firstyear, YEAR(max(post_date_gmt)) AS lastyear FROM $wpdb->posts WHERE post_date_gmt > 1970", null));

    Just thought folks might want to know.

  • The topic ‘Warning: Missing argument 2 for wpdb::prepare()’ is closed to new replies.
Skip to toolbar