WordPress.org

Make WordPress Core

Ticket #20206: 20206.patch

File 20206.patch, 1.6 KB (added by johnbillion, 2 years ago)
  • wp-admin/includes/export.php

     
    4545                if ( ! $ptype->can_export ) 
    4646                        $args['content'] = 'post'; 
    4747 
     48                $post_types = array( $args['content'] ); 
    4849                $where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] ); 
    4950        } else { 
    5051                $post_types = get_post_types( array( 'can_export' => true ) ); 
     
    234235         * 
    235236         * @since 3.1.0 
    236237         */ 
    237         function wxr_authors_list() { 
     238        function wxr_authors_list( $post_types ) { 
    238239                global $wpdb; 
    239240 
    240241                $authors = array(); 
    241                 $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts" ); 
     242                $esses   = array_fill( 0, count($post_types), '%s' ); 
     243                $results = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE {$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types ) ); 
     244 
    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_types ); ?> 
    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>