diff --git a/src/wp-includes/vars.php b/src/wp-includes/vars.php index 5f9257e85a..e285ed8321 100644 --- a/src/wp-includes/vars.php +++ b/src/wp-includes/vars.php @@ -29,9 +29,11 @@ if ( is_admin() ) { } else { preg_match( '#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches ); } - $pagenow = $self_matches[1]; + + $pagenow = ! empty( $self_matches[1] ) ? $self_matches[1] : ''; $pagenow = trim( $pagenow, '/' ); $pagenow = preg_replace( '#\?.*?$#', '', $pagenow ); + if ( '' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow ) { $pagenow = 'index.php'; } else {