首页 > 解决方案 > 当新的 WP_Query 在后循环中时出现错误 502

问题描述

我正在尝试在自定义帖子单个模板中设置自定义帖子提要。代码在单个模板或任何其他查询(页面、帖子)之外都可以正常工作。但是当在一个循环中时。它给出错误 502“页面请求被取消,因为完成时间太长”。错误日志为空。

$args2 = array(
      'post_type'   => 'payout',
      'post_status' => 'publish',
      'tax_query'   => array(
       array(
           'taxonomy' => 'pay_connection',
           'field'    => 'slug',
           'terms'    => '30'
           )
      )
);
$newquery = new WP_Query( $args2 );
if ( have_posts() ) while ($newquery->have_posts()) : $newquery->the_post();
     $custom = get_post_custom($post->ID);
     echo $custom['pay_start'][0];
     echo $custom['pay_end'][0];
     echo '$'. $custom['net_pay'][0];
  endwhile; 
  wp_reset_postdata();

标签: phpwordpress

解决方案


推荐阅读