Skip to content

Commit

Permalink
Simplify check for no posts in query-no-results block (#53772)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocean90 authored Aug 30, 2023
1 parent 4cd8320 commit 324e9b3
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/block-library/src/query-no-results/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,10 @@ function render_block_core_query_no_results( $attributes, $content, $block ) {
$query = new WP_Query( $query_args );
}

if ( $query->have_posts() ) {
if ( $query->post_count > 0 ) {
return '';
}

if ( ! $use_global_query ) {
wp_reset_postdata();
}

$classes = ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) ? 'has-link-color' : '';
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
return sprintf(
Expand Down

0 comments on commit 324e9b3

Please sign in to comment.