当我在 WordPress 设置中启用 PHP 错误报告时,我不断收到此错误。
注意:在 3394 行的/Users/admin/Sites/wp-includes/post.php 中,只应通过引用返回变量引用
我觉得它与分类法及其层次设置有关。
现在在我正在编写的插件中一直试图追踪它。
这些是 WP Core 中的实际代码行,返回在准确的行上。
// 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 实现)
关于wordpress - 错误 : Only variable references should be returned by reference in wp-includes/post.,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11930877/