[aru_2]因为要用一个插件切换为php7.2 结果突然主题有个地方报错[aru_15]
Warning: count(): Parameter must be an array or anobject that implements Countable count
结果搜了一下 emmmm 很多遇到的
错误原因:
php7.2下,count限制了count()函数的参数类型
解决办法:/wp-includes/post-template.php
第310行,修改为
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;
}
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;
}
本文作者为逍遥,转载请注明。