Make WordPress Core

Changeset 19626


Ignore:
Timestamp:
12/22/2011 12:08:26 PM (15 years ago)
Author:
duck_
Message:

Show correct export date range for pages. The query should use provided $post_type instead of always 'post'. Props sorich87. Fixes #19312.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/export.php

    r19596 r19626  
    9696require_once ('admin-header.php');
    9797
    98 function export_date_options() {
     98function export_date_options( $post_type = 'post' ) {
    9999        global $wpdb, $wp_locale;
    100100
    101         $months = $wpdb->get_results( "
     101        $months = $wpdb->get_results( $wpdb->prepare( "
    102102                SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
    103103                FROM $wpdb->posts
    104                 WHERE post_type = 'post' AND post_status != 'auto-draft'
     104                WHERE post_type = %s AND post_status != 'auto-draft'
    105105                ORDER BY post_date DESC
    106         " );
     106        ", $post_type ) );
    107107
    108108        $month_count = count( $months );
     
    183183                <select name="page_start_date">
    184184                        <option value="0"><?php _e( 'Start Date' ); ?></option>
    185                         <?php export_date_options(); ?>
     185                        <?php export_date_options( 'page' ); ?>
    186186                </select>
    187187                <select name="page_end_date">
    188188                        <option value="0"><?php _e( 'End Date' ); ?></option>
    189                         <?php export_date_options(); ?>
     189                        <?php export_date_options( 'page' ); ?>
    190190                </select>
    191191        </li>
Note: See TracChangeset for help on using the changeset viewer.