我不确定为什么你的代码不起作用......但它应该......
这是我的测试结果..
Array
(
[0] => WP_Post Object
(
[ID] => 31
[post_author] => 1
[post_date] => 2013-01-13 04:23:39
[post_date_gmt] => 2013-01-13 04:23:39
[post_content] => fdsfsdfsdfsdfsdfsd
[post_title] => sasd
[post_excerpt] =>
[post_status] => private
[comment_status] => open
[ping_status] => open
[post_password] =>
[post_name] => sasd
[to_ping] =>
[pinged] =>
[post_modified] => 2013-01-13 04:23:39
[post_modified_gmt] => 2013-01-13 04:23:39
[post_content_filtered] =>
[post_parent] => 0
[guid] => http://localhost/wordpress/?p=31
[menu_order] => 0
[post_type] => post
[post_mime_type] =>
[comment_count] => 0
[filter] => raw
)
)
ID on the first post found 31
请确保你有sasd
作为帖子的标题。有这样的固定链接http://localhost/wordpress/2013/01/13/sasd/
要让它显示内容,您需要这样做:$my_posts[0]->post_content
或者只是看看WP_Post Object
我发布的,看看如何获取其他数据的模式..