mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Editor: Update build_comment_query_vars_from_block from Gutenberg
Follow-up for [53138]. See #55505. git-svn-id: https://develop.svn.wordpress.org/trunk@53142 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1392,24 +1392,25 @@ function build_comment_query_vars_from_block( $block ) {
|
||||
$comment_args['hierarchical'] = false;
|
||||
}
|
||||
|
||||
$per_page = get_option( 'comments_per_page' );
|
||||
$default_page = get_option( 'default_comments_page' );
|
||||
if ( get_option( 'page_comments' ) === '1' || get_option( 'page_comments' ) === true ) {
|
||||
$per_page = get_option( 'comments_per_page' );
|
||||
$default_page = get_option( 'default_comments_page' );
|
||||
if ( $per_page > 0 ) {
|
||||
$comment_args['number'] = $per_page;
|
||||
|
||||
if ( $per_page > 0 ) {
|
||||
$comment_args['number'] = $per_page;
|
||||
|
||||
$page = (int) get_query_var( 'cpage' );
|
||||
if ( $page ) {
|
||||
$comment_args['paged'] = $page;
|
||||
} 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;
|
||||
}
|
||||
// Set the `cpage` query var to ensure the previous and next pagination links are correct
|
||||
// when inheriting the Discussion Settings.
|
||||
if ( 0 === $page && isset( $comment_args['paged'] ) && $comment_args['paged'] > 0 ) {
|
||||
set_query_var( 'cpage', $comment_args['paged'] );
|
||||
$page = (int) get_query_var( 'cpage' );
|
||||
if ( $page ) {
|
||||
$comment_args['paged'] = $page;
|
||||
} 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;
|
||||
}
|
||||
// Set the `cpage` query var to ensure the previous and next pagination links are correct
|
||||
// when inheriting the Discussion Settings.
|
||||
if ( 0 === $page && isset( $comment_args['paged'] ) && $comment_args['paged'] > 0 ) {
|
||||
set_query_var( 'cpage', $comment_args['paged'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user