Make WordPress Core

Ticket #10935: 10935.2.diff

File 10935.2.diff, 2.0 KB (added by DrewAPicture, 13 years ago)
  • wp-includes/canonical.php

     
    101101                        }
    102102                }
    103103
     104                if ( get_query_var( 'day' ) && get_query_var( 'monthnum' ) && get_query_var( 'year' )
     105                        && ! checkdate( get_query_var( 'monthnum' ), get_query_var( 'day' ), get_query_var( 'year' ) ) ) {
     106                        $redirect_url = get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) );
     107                        $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum', 'day' ), $redirect_url );
     108                } elseif ( get_query_var( 'monthnum' ) && get_query_var( 'year' ) && 12 < get_query_var( 'monthnum' ) ) {
     109                        $redirect_url = get_year_link( get_query_var( 'year' ) );
     110                        $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum' ), $redirect_url );
     111                }
     112
    104113                if ( ! $redirect_url ) {
    105114                        if ( $redirect_url = redirect_guess_404_permalink() ) {
    106115                                $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'page', 'feed', 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );
  • wp-includes/query.php

     
    15011501
    15021502                        if ( $qv['day'] ) {
    15031503                                if ( ! $this->is_date ) {
    1504                                         $this->is_day = true;
    1505                                         $this->is_date = true;
     1504                                        if ( $qv['monthnum'] && $qv['year'] && ! checkdate( $qv['monthnum'], $qv['day'], $qv['year'] ) ) {
     1505                                                $qv['error'] = '404';
     1506                                        } else {
     1507                                                $this->is_day = true;
     1508                                                $this->is_date = true;
     1509                                        }
    15061510                                }
    15071511                        }
    15081512
    15091513                        if ( $qv['monthnum'] ) {
    15101514                                if ( ! $this->is_date ) {
    1511                                         $this->is_month = true;
    1512                                         $this->is_date = true;
     1515                                        if ( 12 < $qv['monthnum'] ) {
     1516                                                $qv['error'] = '404';
     1517                                        } else {
     1518                                                $this->is_month = true;
     1519                                                $this->is_date = true;
     1520                                        }
    15131521                                }
    15141522                        }
    15151523