admin管理员组文章数量:1420095
I recently made a local copy of an existing site to make development changes. Most everything is working fine in the local version, except that at the top of any Page I see this error (sometimes more than once) –
Warning: count(): Parameter must be an array or an object that implements Countable in /[website directory]/wp-includes/post-template.php on line 284
It looks like <?php wp_head(); ?>
is throwing the error when php checks to see if the selected post has more than one page, and that it's the $pages
variable that's failing. I've tried manually setting $pages
to an empty array before that, but that didn't make any difference.
The only other thing I can think of is that my dev environment is running php 7.2 but the production server (which is working fine) is running 5.6. Might that have anything to do with this issue?
I recently made a local copy of an existing site to make development changes. Most everything is working fine in the local version, except that at the top of any Page I see this error (sometimes more than once) –
Warning: count(): Parameter must be an array or an object that implements Countable in /[website directory]/wp-includes/post-template.php on line 284
It looks like <?php wp_head(); ?>
is throwing the error when php checks to see if the selected post has more than one page, and that it's the $pages
variable that's failing. I've tried manually setting $pages
to an empty array before that, but that didn't make any difference.
The only other thing I can think of is that my dev environment is running php 7.2 but the production server (which is working fine) is running 5.6. Might that have anything to do with this issue?
Share Improve this question asked Jan 6, 2018 at 16:26 jtenclayjtenclay 1011 silver badge2 bronze badges 3 |1 Answer
Reset to default 0Turns out the problem was Jetpack. I looked through the <head>
to see where in the stack it was breaking and it was right in the middle of the Jetpack plugin code.
Looks like it's being worked on here: https://github/Automattic/jetpack/issues/8156 under "PHP warnings." Since Jetpack isn't necessary for my dev server on this project, I deactivated it and haven't had any errors since.
本文标签: wp headquotWarning count()quot printing in Page templates
版权声明:本文标题:wp head - "Warning: count()" printing in Page templates 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745327113a2653643.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
count
do mention count new warnings if invalid countable type variables are passed. Are you able to share the code you believe to be throwing the error. – Andrew Commented Jan 6, 2018 at 16:40