WordPress.org

Make WordPress Core

Ticket #10317: 10317-4.diff

File 10317-4.diff, 1.2 KB (added by michaelh, 3 years ago)

Change to $monthyears to include all post_types and stati and return in ASC order

  • wp-admin/export.php

     
    4343require_once ('admin-header.php'); 
    4444 
    4545$dateoptions = ''; 
    46 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 " ) ) { 
     46$types = "'" . implode("', '", get_post_types( array( 'public' => true, 'can_export' => true ), 'names' )) . "'"; 
     47$stati = "'" . implode("', '", get_post_stati( array( 'internal' => false ), 'names' )) . "'"; 
     48if ( $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 IN ($types) AND post_status IN ($stati) GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date ASC ") ) { 
    4749        foreach ( $monthyears as $monthyear ) { 
    4850                $dateoptions .= "\t<option value=\"" . $monthyear->year . '-' . zeroise( $monthyear->month, 2 ) . '">' . $wp_locale->get_month( $monthyear->month ) . ' ' . $monthyear->year . "</option>\n"; 
    4951        }