Permalink
Browse files

Show correct export date range for pages. The query should use provid…

…ed $post_type instead of always 'post'. Props sorich87. Fixes #19312.

git-svn-id: http://svn.automattic.com/wordpress/trunk@19626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent b20fbf6 commit 29d5e3c83ceef38f93f8cd75e8cdedd694bf4661 duck_ committed Dec 22, 2011
Showing with 6 additions and 6 deletions.
  1. +6 −6 wp-admin/export.php
View
@@ -95,15 +95,15 @@ function add_js() {
require_once ('admin-header.php');
-function export_date_options() {
+function export_date_options( $post_type = 'post' ) {
global $wpdb, $wp_locale;
- $months = $wpdb->get_results( "
+ $months = $wpdb->get_results( $wpdb->prepare( "
SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
FROM $wpdb->posts
- WHERE post_type = 'post' AND post_status != 'auto-draft'
+ WHERE post_type = %s AND post_status != 'auto-draft'
ORDER BY post_date DESC
- " );
+ ", $post_type ) );
$month_count = count( $months );
if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
@@ -182,11 +182,11 @@ function export_date_options() {
<label><?php _e( 'Date range:' ); ?></label>
<select name="page_start_date">
<option value="0"><?php _e( 'Start Date' ); ?></option>
- <?php export_date_options(); ?>
+ <?php export_date_options( 'page' ); ?>
</select>
<select name="page_end_date">
<option value="0"><?php _e( 'End Date' ); ?></option>
- <?php export_date_options(); ?>
+ <?php export_date_options( 'page' ); ?>
</select>
</li>
<li>

0 comments on commit 29d5e3c

Please sign in to comment.