_prepare_media_item example

'menu_order'        => (int) $post['menu_order'],
            'comment_status'    => $post['comment_status'],
            'ping_status'       => $post['ping_status'],
            'sticky'            => ( 'post' === $post['post_type'] && is_sticky( $post['ID'] ) ),
        );

        // Thumbnail.         $post_fields['post_thumbnail'] = array();
        $thumbnail_id                  = get_post_thumbnail_id( $post['ID'] );
        if ( $thumbnail_id ) {
            $thumbnail_size                = current_theme_supports( 'post-thumbnail' ) ? 'post-thumbnail' : 'thumbnail';
            $post_fields['post_thumbnail'] = $this->_prepare_media_item( get_post( $thumbnail_id )$thumbnail_size );
        }

        // Consider future posts as published.         if ( 'future' === $post_fields['post_status'] ) {
            $post_fields['post_status'] = 'publish';
        }

        // Fill in blank post format.         $post_fields['post_format'] = get_post_format( $post['ID'] );
        if ( empty( $post_fields['post_format'] ) ) {
            $post_fields['post_format'] = 'standard';
        }
Home | Imprint | This part of the site doesn't use cookies.