Make WordPress Core

Ticket #30170: export-start-end-date.patch

File export-start-end-date.patch, 781 bytes (added by herbmillerjr, 10 years ago)

Swap start and end dates if start is more recent than end

  • export.php

     
    7676                if ( $args['author'] )
    7777                        $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );
    7878
     79        // Swap start and end dates if, and only if, start date is more recent than end date
     80        if ( $args['start_date'] && $args['end_date'] && $args['start_date'] > $args['end_date'] ) {
     81            $swap = $args['start_date'];
     82            $args['start_date'] = $args['end_date'];
     83            $args['end_date'] = $swap;
     84        }
     85
    7986                if ( $args['start_date'] )
    8087                        $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", date( 'Y-m-d', strtotime($args['start_date']) ) );
    8188