Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 错误:wp includes/post.php中的引用只能返回变量引用_Wordpress_Php - Fatal编程技术网

Wordpress 错误:wp includes/post.php中的引用只能返回变量引用

Wordpress 错误:wp includes/post.php中的引用只能返回变量引用,wordpress,php,Wordpress,Php,当我在我的WordPress设置中打开PHP错误报告时,我一直遇到这个错误 注意:第3394行的/Users/admin/Sites/wp includes/post.php中的引用只能返回变量引用 我觉得这与分类法及其层次结构有关 在我正在编写的插件中,已经尝试跟踪它一段时间了 这些是WP核心中的实际代码行,返回在EXACT行上 // Make sure the post type is hierarchical $hierarchical_post_types = get_post_ty

当我在我的WordPress设置中打开PHP错误报告时,我一直遇到这个错误

注意:第3394行的/Users/admin/Sites/wp includes/post.php中的引用只能返回变量引用

我觉得这与分类法及其层次结构有关

在我正在编写的插件中,已经尝试跟踪它一段时间了

这些是WP核心中的实际代码行,返回在EXACT行上

 // Make sure the post type is hierarchical
 $hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) );
 if ( !in_array( $post_type, $hierarchical_post_types ) )
      return false;

我会一直调试它,直到找到问题,但是如果我没有在插件中找到问题,任何输入都会很好。

返回false-这不是一个变量
试试像这样的东西

if ( !in_array( $post_type, $hierarchical_post_types ) ) {
      $rv = false;
      return $rv;
}

(旁注:我不知道wordpress和/或你在那里使用的mod在做什么,但也许/可能“通过引用返回”是a)首先不必要的,b)php4实现的残余)

也许你的插件调用WP核心函数错误并导致错误(有时使用jQuery)。查看回溯以了解在WP核心函数之前调用的函数是什么。您可以使用
debug\u print\u backtrace()
;干得好。这实际上解决了这个问题。但它位于可湿性粉剂核心,所以我猜将不得不记录一张罚单。奇怪的是,是默认的vanilla get_pages()函数抛出了这个错误(从V.1.5.0开始)。可能是PHP5.4的问题。它似乎只是从我的插件中抛出了注意错误,而不是如果它在主题中……问题在Trac中,它会关注它。