diff --git a/wp-admin/includes/export.php b/wp-admin/includes/export.php
index 5ca5e12526..91ecf793cf 100644
--- a/wp-admin/includes/export.php
+++ b/wp-admin/includes/export.php
@@ -240,12 +240,21 @@ function export_wp( $args = array() ) {
* Output list of authors with posts
*
* @since 3.1.0
+ *
+ * @param array $post_ids Array of post IDs to filter the query by. Optional.
*/
- function wxr_authors_list() {
+ function wxr_authors_list( array $post_ids = null ) {
global $wpdb;
+ if ( !empty( $post_ids ) ) {
+ $post_ids = array_map( 'absint', $post_ids );
+ $and = 'AND ID IN ( ' . implode( ', ', $post_ids ) . ')';
+ } else {
+ $and = '';
+ }
+
$authors = array();
- $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft'" );
+ $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" );
foreach ( (array) $results as $result )
$authors[] = get_userdata( $result->post_author );
@@ -344,7 +353,7 @@ function export_wp( $args = array() ) {
-
+
term_id ?>slug; ?>parent ? $cats[$c->parent]->slug : ''; ?>