WordPress.org

Make WordPress Core

Ticket #20206: 20206.2.diff

File 20206.2.diff, 1.3 KB (added by jeremyfelt, 6 years ago)

Updated patch using $post_ids

  • export.php

     
    233233         * Output list of authors with posts
    234234         *
    235235         * @since 3.1.0
     236         *
     237         * @param array $post_ids Array of post IDs to include in the query
    236238         */
    237         function wxr_authors_list() {
     239        function wxr_authors_list( $post_ids ) {
    238240                global $wpdb;
    239241
    240242                $authors = array();
    241                 $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts" );
     243                $where = 'WHERE ID IN (' . join( ',', $post_ids ) . ')';
     244                $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts $where" );
    242245                foreach ( (array) $results as $result )
    243246                        $authors[] = get_userdata( $result->post_author );
    244247
     
    337340        <wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
    338341        <wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url>
    339342
    340 <?php wxr_authors_list(); ?>
     343<?php wxr_authors_list( $post_ids ); ?>
    341344
    342345<?php foreach ( $cats as $c ) : ?>
    343346        <wp:category><wp:term_id><?php echo $c->term_id ?></wp:term_id><wp:category_nicename><?php echo $c->slug; ?></wp:category_nicename><wp:category_parent><?php echo $c->parent ? $cats[$c->parent]->slug : ''; ?></wp:category_parent><?php wxr_cat_name( $c ); ?><?php wxr_category_description( $c ); ?></wp:category>