【发布时间】:2012-12-14 03:02:15
【问题描述】:
这是我打印出来的。
$args = array(
'category' => 'Animation',
'numberposts' => 8
);
$posts_array = get_posts( $args );
echo json_encode($posts_array);
结果如下:(有 8 个相同的 JSON 列表,为方便起见,仅显示 1 个。)
{"ID":554,"post_author":"1","post_date":"2012-12-28 19:17:43","post_date_gmt":"2012-12-28 19:17:43 ","post_content":"太空竞赛已经开始。随着各国的竞争,我们关注被招募到太空计划中的一只黑猩猩的进步。他的结果可能会为全人类带来更好的影响。......将他准备好迎接挑战了","post_title":"Alpha","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password" :"","post_name":"alpha","to_ping":"","pinged":"","post_modified":"2012-12-28 19:17:43","post_modified_gmt":"2012- 12-28 19:17:43","post_content_filtered":"","post_parent":0,"guid":"http://localhost/Wordpress%203.4.2/?p=554","menu_order": 0,"post_type":"post","post_mime_type":"","comment_count":"0","filter":"raw"
但我只想发送 id 和 post_content。我不断得到空值,但不知道为什么。
【问题讨论】:
标签: wordpress