错误:只有变量引用应该通过 wp-include/post.php 中的引用返回


ERROR: Only variable references should be returned by reference in wp-includes/post.php

当我在WordPress设置中放置PHP错误报告时,我不断收到此错误。

Notice: Only variable references should be returned by reference in /Users/admin/Sites/wp-includes/post.php on line 3394

我有一种感觉,这与分类法及其层次结构设置有关。

一直在尝试在我正在编写的插件中追踪它一段时间。

这些是WP Core中的实际代码行,返回在excact行上。

 // 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;

我会继续调试它,直到找到问题,但是看到我没有在我的插件中追踪到问题,任何输入都会很棒。

return false; - 这不是一个变量
尝试类似的东西

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

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