WordPress.org

Forums

Blocks2
Warning: Missing argument 2 for wpdb::prepare() (1 post)

  1. jarandhel
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic