在我的网站上,我创建了一个具有分层自定义分类法的CPT:
// **CPT Args**
$args = [
\'labels\' => $labels,
\'public\' => true,
\'publicly_queryable\' => false,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'query_var\' => true,
\'rewrite\' => [\'slug\' => \'documento\'],
\'taxonomies\' => [\'tipologia\'],
\'capability_type\' => \'post\',
\'has_archive\' => true,
\'hierarchical\' => false,
\'menu_position\' => null,
\'supports\' => [\'title\']
];
//**Taxonomy Args**
$args = [
\'hierarchical\' => true,
\'labels\' => $labels,
\'show_ui\' => true,
\'show_admin_column\' => true,
\'rewrite\' => [\'slug\' => \'documenti\'
],
];
此处是分页代码:
echo paginate_links(
[
\'base\' => str_replace( $big, \'%#%\', esc_url( get_pagenum_link( $big ) ) ),
\'format\' => \'?paged=%#%\',
\'current\' => max( 1, get_query_var( \'paged\' ) ),
\'total\' => $wp_query->max_num_pages
]
);
奇怪的是,分页在某些术语中效果很好:
示例:
documenti/altri documenti/comunicati/cs-2015/page/2/<;-它可以工作(没有子术语)/documenti/altri documenti/comunicati/page/2/<;-不起作用(本术语有子项)返回404文档i/altri文档i/memore/page/2/<;-它有效(这个术语有孩子)/documenti/altri documenti/memore/page/3/<;-不起作用(此术语有子项)返回404文档i/formulari模块/page/2/<;-它有效(没有子术语)
似乎问题只与父项有关,而与最后一个子项无关。
编辑
禁用永久链接时也会出现此问题:
/?tipologia=altri-documenti&paged=2
<;-这不起作用