Where can I find the fields of the posts, returned by WP_Query?
Lets say I use $query = new WP_Query( arguments );
or $worksArray = get_posts( args );
where can I find the available fields of the returned list so I know what to get from a post?
foreach ($worksArray as $work) {
$work->ID
}
What else there is in the $work object besides the id?
I can't find a class diagram/reference of the returned type. The codexs' documents say it returns the list of posts
but there is no link to see what do this posts can开发者_开发问答 be or what fields are there.
(example: $work->the_title()
, $work->something_else
)
From the page: http://codex.wordpress.org/Function_Reference/get_post#Return
The fields returned are:
ID (integer) The post ID
post_author (integer) The post author's ID
post_date (string) The datetime of the post (YYYY-MM-DD HH:MM:SS)
post_date_gmt (string) The GMT datetime of the post (YYYY-MM-DD HH:MM:SS)
post_content (string) The post's contents
post_title (string) The post's title
post_category (integer) The post category's ID.
post_excerpt (string) The post excerpt
post_status (string) The post status
comment_status (string) The comment status (open|closed|registered_only)
ping_status (string) The pingback/trackback status (open|closed)
post_password (string) The post password
post_name (string) The post's URL slug
to_ping (string) URLs to be pinged
pinged (string) URLs already pinged
post_modified (string) The last modified datetime of the post
post_modified_gmt (string) The last modified GMT datetime of the post
post_content_filtered (string)
post_parent (integer) The parent post's ID (for attachments, etc)
guid (string) A link to the post.
menu_order (integer)
post_type (string) (post|page|attachment)
post_mime_type (string) Mime Type (for attachments, etc)
comment_count (integer) Number of comments
精彩评论