From f731ae70e1339f568ac5868eedff0da3aa706d5f Mon Sep 17 00:00:00 2001 From: Sarah Norris <1645628+mikachan@users.noreply.github.com> Date: Fri, 20 Sep 2024 17:50:41 +0100 Subject: [PATCH] Query Loop: Remove is_singular() check and fix test (#65483) * Replace query_posts() with set() * Fix test_rendering_post_template_with_main_query_loop_already_started test * Remove is_singular check Co-authored-by: mikachan Co-authored-by: jffng Co-authored-by: David Herrera <697432+dlh01@users.noreply.github.com> --- packages/block-library/src/post-template/index.php | 5 ----- phpunit/blocks/render-post-template-test.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/block-library/src/post-template/index.php b/packages/block-library/src/post-template/index.php index 64cdd156a54310..9126355c096a57 100644 --- a/packages/block-library/src/post-template/index.php +++ b/packages/block-library/src/post-template/index.php @@ -64,11 +64,6 @@ function render_block_core_post_template( $attributes, $content, $block ) { if ( in_the_loop() ) { $query = clone $wp_query; $query->rewind_posts(); - - // If in a single post of any post type, default to the 'post' post type. - if ( is_singular() ) { - query_posts( array( 'post_type' => 'post' ) ); - } } else { $query = $wp_query; } diff --git a/phpunit/blocks/render-post-template-test.php b/phpunit/blocks/render-post-template-test.php index 6241f6f0605164..e929e459654fe7 100644 --- a/phpunit/blocks/render-post-template-test.php +++ b/phpunit/blocks/render-post-template-test.php @@ -122,7 +122,7 @@ public function test_rendering_post_template_with_main_query_loop_already_starte global $wp_query, $wp_the_query; // Query block with post template block. - $content = ''; + $content = ''; $content .= ''; $content .= ''; $content .= '';