报错内容为:
Warning: count(): Parameter must be an array or an object that
implements Countable in /wp-includes/post-template.php on line 284
后台查询是wordpress根目录/wp-includes/post-template.php的第284行报错。
if ( $page > count( $pages ) ) // if the requested page doesn't exist
$page = count( $pages ); // give them the highest numbered page that DOES exist
发现是wordpress对php7.2的兼容性问题,找到了解决办法,复制下面内容并进行替换保存既可解决问题:
if ( is_array( $pages ) ) {
if ( $page > count( $pages ) ) // if the requested page doesn’t exist
$page = count( $pages ); // give them the highest numbered page that DOES exist
} else {
$page = 0;
}
评论