错误:在wp-includes/post.php中,只能通过引用返回变量引用

Fox*_*nni 4 php wordpress

当我在我的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;
Run Code Online (Sandbox Code Playgroud)

我会一直调试它,直到找到问题,但任何输入都会很棒,因为我没有在我的插件中找到问题.

Vol*_*erK 6

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

if ( !in_array( $post_type, $hierarchical_post_types ) ) {
      $rv = false;
      return $rv;
}
Run Code Online (Sandbox Code Playgroud)

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