你不需要使用get_posts( \'post_type=attachment\' )
要返回附件ID?比如:
$args = array(
\'post_type\' => \'attachment\',
\'numberposts\' => -1,
\'post_status\' => null,
\'post_parent\' => $post->ID
);
$attachments = get_posts( $args );
$myimageid = $attachments[0]->ID;
wp_get_attachment_image( $myimageid, \'full\' );
否则,您将使用$post->ID为1,这可能不起作用。