WordPress Blocks2无图主题出错解决方法Warning: Missing argument 2 for wpdb
dota闪电站小猪最近想搭个搞笑的gif博客类网站,http://gif.shandian.biz/,遇到了如下的错误:
Warning: Missing argument 2 for wpdb::prepare(), called in /data1/www/htdocs/341/xxx/1/wp-content/themes/blocks2/header.php on line 145 and defined in wp-includes/wp-db.php on line 1154
Blocks2 Warning: Missing argument 2 for wpdb::prepare()
在wordpress官方论坛找到了解决方法:
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.
这个主题的作者neoease已经多年没更新了…使用需要谨慎,他还有一款主题inove很流行,不过也没再更新了。
http://www.neoease.com/themes/