From 0f458c21800c82d1a52897aeada8d35f7d58a03a Mon Sep 17 00:00:00 2001
From: Sander van Dragt <sander@vandragt.com>
Date: Tue, 7 Jul 2020 15:58:15 +0100
Subject: [PATCH] Fix #50571 List homepage when site contains no pages.
---
inc/providers/class-wp-sitemaps-posts.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/inc/providers/class-wp-sitemaps-posts.php b/inc/providers/class-wp-sitemaps-posts.php
index 7e89de1..d116466 100644
a
|
b
|
class WP_Sitemaps_Posts extends WP_Sitemaps_Provider { |
178 | 178 | $args['no_found_rows'] = false; |
179 | 179 | |
180 | 180 | $query = new WP_Query( $args ); |
181 | | |
182 | | return isset( $query->max_num_pages ) ? $query->max_num_pages : 1; |
| 181 | $min_num_pages = (int)($post_type === 'page'); |
| 182 | return isset( $query->max_num_pages ) ? max($min_num_pages,$query->max_num_pages) : 1; |
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |