[wp-trac] [WordPress Trac] #57491: Php 8.2.0 - error if the Wp Query does not have any post

WordPress Trac noreply at wordpress.org
Wed Jan 18 15:14:21 UTC 2023


#57491: Php 8.2.0 -  error if the Wp Query does not have any post
-------------------------------+------------------------------
 Reporter:  davidki            |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Query              |     Version:  6.1.1
 Severity:  major              |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by davidki):

 Here is my custom query wich I use, but I don't see problem here:

 {{{
 <?php
    $args = array('post_type' => 'post', 'post_status' => 'publish',
 'posts_per_page' => 10, 'ignore_sticky_posts' => 1, 'orderby' =>
 'meta_value_num', 'order' => 'DESC', 'meta_key' => 'post_wish_count',
 'tax_query' => array('relation' => 'AND', array('taxonomy' => 'typ',
 'field' => 'slug', 'terms' => array('produkt')), array('taxonomy' =>
 'typ', 'field' => 'slug', 'terms' => 'vyprodano', 'operator' => 'NOT
 IN')));
    $query_katalog = new WP_Query($args);
    if($query_katalog->have_posts()): while($query_katalog->have_posts()) :
 $query_katalog->the_post(); the_title(); endwhile;
    else:?>
     <p>Nothing found</p>
    <?php endif; wp_reset_postdata();?>
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57491#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list