diff --git a/packages/block-library/src/query/index.php b/packages/block-library/src/query/index.php index d834ed040877d4..ef9fd400c5366c 100644 --- a/packages/block-library/src/query/index.php +++ b/packages/block-library/src/query/index.php @@ -37,7 +37,7 @@ function register_block_core_query() { * @return array Return an array of args. */ function core_query_attributes_to_critera( $criteria ) { - if ( $criteria[ 'specificMode' ] == 1 ) { + if ( isset( $criteria[ 'specificMode' ] ) && $criteria[ 'specificMode' ] == 1 ) { $args = array( 'post_status' => 'publish', 'p' => $criteria[ 'singleId' ], @@ -70,15 +70,17 @@ function core_query_attributes_to_critera( $criteria ) { function render_block_core_query( $attributes ) { $blocks = ! empty( $attributes['blocks'] ) ? $attributes['blocks'] : array(); $args = core_query_attributes_to_critera( $attributes['criteria'] ); + $posts_to_show = $args['posts_per_page']; $args['posts_per_page'] = $args['posts_per_page'] + count( Blocks_Query::$displayedPostIds ); $query = new WP_Query( $args ); + $posts_shown = 0; ob_start(); ?>