Php Wordpress分页404英寸&;paged=2

Php Wordpress分页404英寸&;paged=2,php,wordpress,Php,Wordpress,有两种自定义的帖子类型,我在一个叫做新闻事件的页面上循环浏览。当我对结果进行分页并点击相关页面时,我会看到404页面。已经通过更换永久链接,但仍然不起作用。也了解法拉盛permalinks,并且已经做到了这一点。分页代码也在下面,但我不认为是这样的,因为它对搜索页面非常有效。 functions.php: function show_product_by_cat($cat_id, $paged) { global $result; $discount=0; gl

有两种自定义的帖子类型,我在一个叫做新闻事件的页面上循环浏览。当我对结果进行分页并点击相关页面时,我会看到404页面。已经通过更换永久链接,但仍然不起作用。也了解法拉盛permalinks,并且已经做到了这一点。分页代码也在下面,但我不认为是这样的,因为它对搜索页面非常有效。 functions.php:

function show_product_by_cat($cat_id, $paged) {
    
    global $result;
    $discount=0;
    global $old_price;
    /*Paganation*/
    global $wp_query, $args, $the_query;
    $args = array(
    'paged'          => $paged,
    'post_type'      => 'product',
    'posts_per_page' => 8,
    'cat'            => $cat_id,
);
$the_query = new WP_Query($args);
if ($the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
   $the_query->the_post();
    echo '<div class="col-lg-3 col-md-3 col-sm-3 col-xs-6 mb-3">'.
   '<div class="ct-product__column">'.
   '<a href="'.get_permalink().'"><div class="pos-rel">'.
   '<img class="ct-img-shoes pos-rel" src="'.wp_get_attachment_url(get_post_thumbnail_id(), 'thumbnail').'" alt="" title="'.get_the_title().'">';
} 
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
    'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    'format' => '?paged=%#%',
    'current' => max( 1, get_query_var('paged') ),
    'total' =>  $the_query->max_num_pages
) );
} else {
    // no posts found
    echo '<h1 class="page-title screen-reader-text">Empty</h1>';
}
按类别显示商品的功能($cat\u id,$paged){
全球$结果;
$折扣=0;
全球$old_价格;
/*分页*/
全局$wp_query,$args,$the_query;
$args=数组(
“paged”=>$paged,
“post_类型”=>“产品”,
“每页帖子数”=>8,
“猫”=>$cat\u id,
);
$thew_query=newwp_query($args);
if($the\u query->have\u posts()){
while($the\u query->have\u posts()){
$the_query->the_post();
回显“”。
''.
"

我尝试了许多不同的教程,但都失败了。当访问路径/?Cat_id=2&paged=2时,所有页面都重定向到404页。我是WordPress的新用户,希望大家都能帮助我