当我们开发和优化WordPress时,最重要的是WordPress的周期。我们的大部分内容输出都是通过WP_uu查询和Query_u查询。posts函数用于循环输出。同样,我们经常使用get_uupost函数来获取指定文章的内容。
当我们得到这些内容时,我们应该如何称呼它们?我们需要知道,无论是一个循环的多个内容还是单个内容,我们都需要知道具体的输出字段,这样我们就可以直接调用它们。
WP_Post Object ( [ID] => [post_author] => [post_date] => [post_date_gmt] => [post_content] => [post_title] => [post_excerpt] => [post_status] => [comment_status] => [ping_status] => [post_password] => [post_name] => [to_ping] => [pinged] => [post_modified] => [post_modified_gmt] => [post_content_filtered] => [post_parent] => [guid] => [menu_order] => [post_type] => [post_mime_type] => [comment_count] => [filter] => )
举例
$post = get_post( 10 ); $pid = $post->ID;