【发布时间】:2016-01-05 06:34:19
【问题描述】:
我正在使用这种方式在帖子中获取图片,例如:
$images =& get_children( 'post_type=attachment&post_mime_type=image&post_parent='.get_the_ID() );
它的工作很好,但在控制台中显示这个错误: 只有变量应该通过引用分配
如何解决?
【问题讨论】:
-
你试过了吗:
$images = get_children( 'post_type=attachment&post_mime_type=image&post_parent='.get_the_ID() );? -
您可以通过引用变量、新语句或函数返回的引用传递。阅读更多here。只需删除
&,您就会在$images变量中获得可以使用的数组。 -
是的,它的工作,,,谢谢
标签: wordpress