Wordpress post-template的PHP7.2报错

Wordpress post-template的PHP7.2报错

ruinous
2018-12-05 / 0 评论 / 17 阅读 / 正在检测是否收录...

报错内容为:

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;
}
0

评论

博主关闭了所有页面的评论