【发布时间】:2020-03-22 05:26:16
【问题描述】:
我创建了一个与我的页面同名的自定义帖子类型。我用自定义代码修复了这个问题,现在可以工作了:
'has_archive' => false,
'rewrite' => array(
'slug' =>'case-studies',
'with_front' => false
但是现在,当我点击自定义帖子类型“案例研究”帖子列表中的分页链接时(或输入像 www.beezer.com/case-studies/page/2 这样的 URL),我得到了 404 页面。
我尝试了很多自定义代码,包括使用 Monkeyman Rewrite Analyzer,但它不起作用。
function my_pagination_rewrite() {
add_rewrite_rule('case-studies/([^/]+)?(:/([0-9]+))?/?$', 'index.php?category_name=case-studies&paged=$matches[1]', 'top');
}
add_action('init', 'my_pagination_rewrite');
谁能帮忙?
【问题讨论】:
标签: php wordpress pagination http-status-code-404 custom-post-type