WordPress.org

Make WordPress Core

Changeset 45214


Ignore:
Timestamp:
04/16/2019 03:33:38 PM (4 months ago)
Author:
SergeyBiryukov
Message:

Permalinks: Avoid a PHP notice in wp_resolve_numeric_slug_conflicts() when visiting a day archive with the /%postname%/ permalink structure.

Props thakkarhardik, thomstark.
Fixes #46828.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rewrite.php

    r42343 r45214  
    377377    if ( 0 === $postname_index && ( isset( $query_vars['year'] ) || isset( $query_vars['monthnum'] ) ) ) {
    378378        $compare = 'year';
    379     } elseif ( '%year%' === $permastructs[ $postname_index - 1 ] && ( isset( $query_vars['monthnum'] ) || isset( $query_vars['day'] ) ) ) {
     379    } elseif ( $postname_index && '%year%' === $permastructs[ $postname_index - 1 ] && ( isset( $query_vars['monthnum'] ) || isset( $query_vars['day'] ) ) ) {
    380380        $compare = 'monthnum';
    381     } elseif ( '%monthnum%' === $permastructs[ $postname_index - 1 ] && isset( $query_vars['day'] ) ) {
     381    } elseif ( $postname_index && '%monthnum%' === $permastructs[ $postname_index - 1 ] && isset( $query_vars['day'] ) ) {
    382382        $compare = 'day';
    383383    }
Note: See TracChangeset for help on using the changeset viewer.