From 684a20a176c78956aec8059945f53f8a5ff47b28 Mon Sep 17 00:00:00 2001 From: wpmuguru Date: Fri, 7 May 2010 20:51:01 +0000 Subject: [PATCH] include dates from all post types/stati. props michaelh, see #10317 git-svn-id: http://svn.automattic.com/wordpress/trunk@14506 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/export.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wp-admin/export.php b/wp-admin/export.php index 1f3ffc4a4..725b759d3 100644 --- a/wp-admin/export.php +++ b/wp-admin/export.php @@ -42,10 +42,12 @@ if ( isset( $_GET['download'] ) ) { require_once ('admin-header.php'); -$dateoptions = ''; -if ( $monthyears = $wpdb->get_results( "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC " ) ) { +$dateoptions = array(); +$types = "'" . implode("', '", get_post_types( array( 'public' => true, 'can_export' => true ), 'names' )) . "'"; +$stati = "'" . implode("', '", get_post_stati( array( 'internal' => false ), 'names' )) . "'"; +if ( $monthyears = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month` FROM $wpdb->posts WHERE post_type IN ($types) AND post_status IN ($stati) ORDER BY post_date ASC ") ) { foreach ( $monthyears as $monthyear ) { - $dateoptions .= "\t\n"; + $dateoptions[] = "\t\n"; } } @@ -67,12 +69,12 @@ if ( $monthyears = $wpdb->get_results( "SELECT YEAR(post_date) AS `year`, MONTH(