【问题标题】:Custom post type pagination return 404 error自定义帖子类型分页返回 404 错误
【发布时间】:2020-07-23 11:01:14
【问题描述】:

CPT 分页有问题。 我尝试使用:

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args_event = array(
    'post_type' => 'cpt_wydarzenia',
    'posts_per_page' => 5,
    'post_status' => 'publish',
    'order' => 'DESC',
    'category_name' => 'wydarzenie',
    'ignore_sticky_posts' => 1,
    'post_status' => array('future', 'publish'),
    'paged' => $paged
);

和:

echo paginate_links(
    array(
        'base' => str_replace($big, '%#%', get_pagenum_link($big)),
        'format' => '?paged=%#%',
        'current' => max(1, get_query_var('paged')),
        'total' => $event_post_query->max_num_pages,
        'prev_text' => '«',
        'next_text' => '»'
    )
);

我尝试刷新永久链接,将永久链接更改为不同的类型,但在每一页上仍然有 404 error

【问题讨论】:

    标签: wordpress pagination custom-post-type


    【解决方案1】:

    问题解决了。 我只是有相同的页面名称和自定义 posty 类型

    我的页面显示帖子:page.pl/wydarzenia 和自定义帖子类型也有名称“wydarzenia”。我只是在显示所有自定义帖子的页面中更改 url。

    【讨论】:

      猜你喜欢
      • 2020-03-22
      • 1970-01-01
      • 2014-09-29
      • 2015-06-07
      • 2012-01-06
      • 2014-05-20
      • 1970-01-01
      • 1970-01-01
      • 2017-09-22
      相关资源
      最近更新 更多