大佬教程收集整理的这篇文章主要介绍了Wordpress body_class 问题,调用一些警告,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
在我打开 wordpress 调试模式后,我注意到有一些问题:
Warning: call_user_func_array() expects parameter 1 to be a valID callBACk,function '' not found or invalID function name in /home/kafijass/public_HTML/wp-includes/class-wp-hook.php on line 294
Warning: array_unique() expects parameter 1 to be array,null given in /home/kafijass/public_HTML/wp-includes/post-template.php on line 838
Warning: implode(): InvalID arguments passed in /home/kafijass/public_HTML/wp-includes/post-template.php on line 595
class="">
我在浏览器中打开页面源代码,发现警告来自 body_class。我从我的 HTML body 标签中删除了 body_class 函数,警告消失了。为什么 wordpress 会这么乱?甚至不要在每次更新后开始说 woocomerce 愚蠢的结构和错误......
这里有三个错误。因为我没有堆栈跟踪,所以很难准确地查明问题的根源,但个别警告告诉我们很多事情。
Warning: call_user_func_array() expects parameter 1 to be a valid callBACk,function '' not found or invalid function name in /home/kafijass/public_html/wp-includes/class-wp-hook.php on line 294
这通常发生在您使用任何钩子、过滤器或操作并向其传递函数但未定义时。例如。
add_action('wp_loaded','a_function_which_should_handle_it');
function not_the_correct_function() {
...
}
如您所见,函数名称与 a_function_which_should_handle_it
不匹配,或者它甚至可能根本不存在。发生此类错误时就是这种情况。
2.Warning: array_unique() expects parameter 1 to be array,null given in /home/kafijass/public_html/wp-includes/post-template.php on line 838
当您在帖子模板上使用 wordpress 函数并且它接受数组时,通常会发生这种情况,但您没有提供数组,或者可能发生了某些边缘情况,其中值的类型与函数预期的不同。这需要开发人员查看才能修复。
Warning: implode(): Invalid arguments passed in /home/kafijass/public_html/wp-includes/post-template.php on line 595 class="">
php 中的 implode 函数用于“将数组的元素与字符串连接起来”。 implode() 函数从数组元素返回一个字符串。
这再次意味着该函数需要一个数组,而您没有将数组传递给它。
确保它的一个好方法是始终检查它。
if (is_array($variablE)) {
// Then do something.
}
我希望这些线索可以帮助您找到错误的根源。
以上是大佬教程为你收集整理的Wordpress body_class 问题,调用一些警告全部内容,希望文章能够帮你解决Wordpress body_class 问题,调用一些警告所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。