小编Dan*_*ikh的帖子

category.php上的分页在wordpress中不起作用

我使用自定义永久链接/%category%/%postname%/在类别的页面上(category.php)我使用分页,例如/ shops/paged/2并得到404错误

PS如果我去/ shops/paged/1它工作PPS使用自定义查询WP_Query和wp_pagenavi()

global $paged;
if (get_query_var( 'paged' ))
    $my_page = get_query_var( 'paged' );
else {
    if( get_query_var( 'page' ) )
        $my_page = get_query_var( 'page' );
    else
        $my_page = 1;
    set_query_var( 'paged', $my_page );
    $paged = $my_page;
}
$args = array(array('posts_per_page'   => 2, 'paged'            => $paged, 'post_type' => 'post', 'category_name'    => 'my_category_nicename'));

$the_query = new WP_Query( $args );

...

while ( $the_query->have_posts() ):

...
Run Code Online (Sandbox Code Playgroud)

我该如何解决?

非常感谢你!!

wordpress pagination permalinks http-status-code-404

1
推荐指数
1
解决办法
3159
查看次数