From 65837fb178e56c3b1af770d583377f66cb2c2ad4 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 16 Apr 2019 15:33:38 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@45214 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/rewrite.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/rewrite.php b/src/wp-includes/rewrite.php index 71a83ac3e9..a03754f272 100644 --- a/src/wp-includes/rewrite.php +++ b/src/wp-includes/rewrite.php @@ -376,9 +376,9 @@ function wp_resolve_numeric_slug_conflicts( $query_vars = array() ) { $compare = ''; if ( 0 === $postname_index && ( isset( $query_vars['year'] ) || isset( $query_vars['monthnum'] ) ) ) { $compare = 'year'; - } elseif ( '%year%' === $permastructs[ $postname_index - 1 ] && ( isset( $query_vars['monthnum'] ) || isset( $query_vars['day'] ) ) ) { + } elseif ( $postname_index && '%year%' === $permastructs[ $postname_index - 1 ] && ( isset( $query_vars['monthnum'] ) || isset( $query_vars['day'] ) ) ) { $compare = 'monthnum'; - } elseif ( '%monthnum%' === $permastructs[ $postname_index - 1 ] && isset( $query_vars['day'] ) ) { + } elseif ( $postname_index && '%monthnum%' === $permastructs[ $postname_index - 1 ] && isset( $query_vars['day'] ) ) { $compare = 'day'; }