diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index adaf1ae255..9df70abaf4 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -1325,7 +1325,10 @@ function build_comment_query_vars_from_block( $block ) { } elseif ( 'oldest' === $default_page ) { $comment_args['paged'] = 1; } elseif ( 'newest' === $default_page ) { - $comment_args['paged'] = (int) ( new WP_Comment_Query( $comment_args ) )->max_num_pages; + $max_num_pages = (int) ( new WP_Comment_Query( $comment_args ) )->max_num_pages; + if ( 0 !== $max_num_pages ) { + $comment_args['paged'] = $max_num_pages; + } } // Set the `cpage` query var to ensure the previous and next pagination links are correct // when inheriting the Discussion Settings. diff --git a/wp-includes/version.php b/wp-includes/version.php index 609e41e5cf..0fa55f675d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-beta4-53335'; +$wp_version = '6.0-beta4-53336'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.